home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / Report Writers / Crystal Repot 9.0 Full CD version / Setup.exe / Tools / Developers / crpe32dynamic.h < prev    next >
Encoding:
C/C++ Source or Header  |  2002-06-25  |  127.7 KB  |  3,198 lines

  1. /*
  2. ** File:    CRPE.h
  3. **
  4. ** Authors: Crystal Decisions, Inc.
  5. ** Date:    13 Nov 91
  6. **
  7. ** Purpose: This file presents the API to the Crystal Reports
  8. **          Print Engine DLL.
  9. **
  10. ** Copyright (c) 1991-2002  Crystal Decisions, Inc.
  11. */
  12.  
  13. #if !defined (CRPE_H)
  14. #define CRPE_H
  15.  
  16. #if !defined (___PETYPES_H_)
  17.     #include "petypes.h"
  18. #endif
  19.  
  20. // Set 1-byte structure alignment
  21. #if defined (__BORLANDC__)      // Borland C/C++
  22.   #pragma option -a-
  23. #elif defined (_MSC_VER)        // Microsoft Visual C++
  24.   #if _MSC_VER >= 900           // MSVC 2.x and later
  25.     #pragma pack (push)
  26.     #pragma comment (lib, "crpe32dynamic.lib") // Point to Microsoft Lib File
  27.   #endif
  28.   #pragma pack (1)
  29. #endif
  30.  
  31. #if defined (__cplusplus)
  32. extern "C"
  33. {
  34. #endif
  35.  
  36. /*********************************************/
  37. // CRPE error code
  38. /*********************************************/
  39. #define PE_ERR_NOERROR                      0
  40.  
  41. #define PE_ERR_NOTENOUGHMEMORY              500
  42. #define PE_ERR_INVALIDJOBNO                 501
  43. #define PE_ERR_INVALIDHANDLE                502
  44. #define PE_ERR_STRINGTOOLONG                503
  45. #define PE_ERR_NOSUCHREPORT                 504
  46. #define PE_ERR_NODESTINATION                505
  47. #define PE_ERR_BADFILENUMBER                506
  48. #define PE_ERR_BADFILENAME                  507
  49. #define PE_ERR_BADFIELDNUMBER               508
  50. #define PE_ERR_BADFIELDNAME                 509
  51. #define PE_ERR_BADFORMULANAME               510
  52. #define PE_ERR_BADSORTDIRECTION             511
  53. #define PE_ERR_ENGINENOTOPEN                512
  54. #define PE_ERR_INVALIDPRINTER               513
  55. #define PE_ERR_PRINTFILEEXISTS              514
  56. #define PE_ERR_BADFORMULATEXT               515
  57. #define PE_ERR_BADGROUPSECTION              516
  58. #define PE_ERR_ENGINEBUSY                   517
  59. #define PE_ERR_BADSECTION                   518
  60. #define PE_ERR_NOPRINTWINDOW                519
  61. #define PE_ERR_JOBALREADYSTARTED            520
  62. #define PE_ERR_BADSUMMARYFIELD              521
  63. #define PE_ERR_NOTENOUGHSYSRES              522
  64. #define PE_ERR_BADGROUPCONDITION            523
  65. #define PE_ERR_JOBBUSY                      524
  66. #define PE_ERR_BADREPORTFILE                525
  67. #define PE_ERR_NODEFAULTPRINTER             526
  68. #define PE_ERR_SQLSERVERERROR               527
  69. #define PE_ERR_BADLINENUMBER                528
  70. #define PE_ERR_DISKFULL                     529
  71. #define PE_ERR_FILEERROR                    530
  72. #define PE_ERR_INCORRECTPASSWORD            531
  73. #define PE_ERR_BADDATABASEDLL               532
  74. #define PE_ERR_BADDATABASEFILE              533
  75. #define PE_ERR_ERRORINDATABASEDLL           534
  76. #define PE_ERR_DATABASESESSION              535
  77. #define PE_ERR_DATABASELOGON                536
  78. #define PE_ERR_DATABASELOCATION             537
  79. #define PE_ERR_BADSTRUCTSIZE                538
  80. #define PE_ERR_BADDATE                      539
  81. #define PE_ERR_BADEXPORTDLL                 540
  82. #define PE_ERR_ERRORINEXPORTDLL             541
  83. #define PE_ERR_PREVATFIRSTPAGE              542
  84. #define PE_ERR_NEXTATLASTPAGE               543
  85. #define PE_ERR_CANNOTACCESSREPORT           544
  86. #define PE_ERR_USERCANCELLED                545
  87. #define PE_ERR_OLE2NOTLOADED                546
  88. #define PE_ERR_BADCROSSTABGROUP             547
  89. #define PE_ERR_NOCTSUMMARIZEDFIELD          548
  90. #define PE_ERR_DESTINATIONNOTEXPORT         549
  91. #define PE_ERR_INVALIDPAGENUMBER            550
  92. #define PE_ERR_NOTSTOREDPROCEDURE           552
  93. #define PE_ERR_INVALIDPARAMETER             553
  94. #define PE_ERR_GRAPHNOTFOUND                554
  95. #define PE_ERR_INVALIDGRAPHTYPE             555
  96. #define PE_ERR_INVALIDGRAPHDATA             556
  97. #define PE_ERR_CANNOTMOVEGRAPH              557
  98. #define PE_ERR_INVALIDGRAPHTEXT             558
  99. #define PE_ERR_INVALIDGRAPHOPT              559
  100. #define PE_ERR_BADSECTIONHEIGHT             560
  101. #define PE_ERR_BADVALUETYPE                 561
  102. #define PE_ERR_INVALIDSUBREPORTNAME         562
  103. #define PE_ERR_NOPARENTWINDOW               564 // dialog parent window
  104. #define PE_ERR_INVALIDZOOMFACTOR            565 // zoom factor
  105. #define PE_ERR_PAGESIZEOVERFLOW             567
  106. #define PE_ERR_LOWSYSTEMRESOURCES           568
  107. #define PE_ERR_BADGROUPNUMBER               570
  108. #define PE_ERR_INVALIDOBJECTFORMATNAME      571
  109. #define PE_ERR_INVALIDNEGATIVEVALUE         572
  110. #define PE_ERR_INVALIDMEMORYPOINTER         573
  111. #define PE_ERR_INVALIDOBJECTTYPE            574
  112. #define PE_ERR_INVALIDGRAPHDATATYPE         577
  113. #define PE_ERR_INVALIDSUBREPORTLINKNUMBER   582
  114. #define PE_ERR_SUBREPORTLINKEXIST           583
  115. #define PE_ERR_BADROWCOLVALUE               584
  116. #define PE_ERR_INVALIDSUMMARYNUMBER         585
  117. #define PE_ERR_INVALIDGRAPHDATAFIELDNUMBER  586
  118. #define PE_ERR_INVALIDSUBREPORTNUMBER       587
  119. #define PE_ERR_INVALIDFIELDSCOPE            588
  120. #define PE_ERR_FIELDINUSE                   590
  121. #define PE_ERR_INVALIDPARAMETERNUMBER       594
  122. #define PE_ERR_INVALIDPAGEMARGINS           595
  123. #define PE_ERR_REPORTONSECUREQUERY          596
  124. #define PE_ERR_CANNOTOPENSECUREQUERY        597
  125. #define PE_ERR_INVALIDSECTIONNUMBER         598
  126. #define PE_ERR_SQLSERVERNOTOPENED           599
  127. #define PE_ERR_TABLENAMEEXIST               606
  128. #define PE_ERR_INVALIDCURSOR                607
  129. #define PE_ERR_FIRSTPASSNOTFINISHED         608
  130. #define PE_ERR_CREATEDATASOURCE             609
  131. #define PE_ERR_CREATEDRILLDOWNPARAMETERS    610
  132. #define PE_ERR_CHECKFORDATASOURCECHANGES    613
  133. #define PE_ERR_STARTBACKGROUNDPROCESSING    614
  134. #define PE_ERR_SQLSERVERINUSE               619
  135. #define PE_ERR_GROUPSORTFIELDNOTSET         620
  136. #define PE_ERR_CANNOTSETSAVESUMMARIES       621
  137. #define PE_ERR_LOADOLAPDATABASEMANAGER      622
  138. #define PE_ERR_OPENOLAPCUBE                 623
  139. #define PE_ERR_READOLAPCUBEDATA             624
  140. #define PE_ERR_CANNOTSAVEQUERY              626
  141. #define PE_ERR_CANNOTREADQUERYDATA          627
  142. #define PE_ERR_MAINREPORTFIELDLINKED        629
  143. #define PE_ERR_INVALIDMAPPINGTYPEVALUE      630
  144. #define PE_ERR_HITTESTFAILED                636
  145. #define PE_ERR_BADSQLEXPRESSIONNAME         637 // no SQL expression by the specified *name* exists in this report.
  146. #define PE_ERR_BADSQLEXPRESSIONNUMBER       638 // no SQL expression by the specified *number* exists in this report.
  147. #define PE_ERR_BADSQLEXPRESSIONTEXT         639 // not a valid SQL expression
  148. #define PE_ERR_INVALIDDEFAULTVALUEINDEX     641 // invalid index for default value of a parameter.
  149. #define PE_ERR_NOMINMAXVALUE                642 // the specified PE_PF_* type does not have min/max values.
  150. #define PE_ERR_INCONSISTANTTYPES            643 // if both min and max values are specified in PESetParameterMinMaxValue,
  151.                                                 // the value types for the min and max must be the same.
  152.  
  153. #define PE_ERR_CANNOTLINKTABLES             645
  154. #define PE_ERR_CREATEROUTER                 646
  155.  
  156. #define PE_ERR_INVALIDFIELDINDEX            647
  157. #define PE_ERR_INVALIDGRAPHTITLETYPE        648
  158. #define PE_ERR_INVALIDGRAPHTITLEFONTTYPE    649
  159.  
  160. #define PE_ERR_PARAMTYPEDIFFERENT           650 // the type used in a add/set value API for a
  161.                                                 // parameter differs with it's existing type.
  162. #define PE_ERR_INCONSISTANTRANGETYPES       651 // the value type for both start & end range
  163.                                                 // values must be the same.
  164. #define PE_ERR_RANGEORDISCRETE              652 // an operation was attempted on a discrete parameter that is
  165.                                                 // only legal for range parameters or vice versa.
  166.  
  167. #define PE_ERR_NOTMAINREPORT                654 // an operation was attempted that is disallowed for subreports.
  168. #define PE_ERR_INVALIDCURRENTVALUEINDEX     655 // invalid index for current value of a parameter.
  169. #define PE_ERR_LINKEDPARAMVALUE             656 // operation illegal on linked parameter.
  170.  
  171. #define PE_ERR_INVALIDPARAMETERRANGEINFO    672 // Invalid PE_RI_* combination.
  172. #define PE_ERR_INVALIDSORTMETHODINDEX       674 // Invalid sort method index.
  173.  
  174. #define PE_ERR_INVALIDGRAPHSUBTYPE          675 // Invalid PE_GST_* or 
  175.                                                 // PE_GST_* does not match PE_GT_* or 
  176.                                                 // PE_GST_* current graph type.
  177. #define PE_ERR_BADGRAPHOPTIONINFO           676 // one of the members of PEGraphOptionInfo is out of range.
  178. #define PE_ERR_BADGRAPHAXISINFO             677 // one of the members of PEGraphAxisInfo is out of range.
  179.  
  180. #define PE_ERR_NOTEXTERNALSUBREPORT         680 // the subreport is not imported.
  181. #define PE_ERR_INVALIDPARAMETERVALUE        687
  182. #define PE_ERR_INVALIDFORMULASYNTAXTYPE     688 // specified formula syntax not in PE_FST_*
  183. #define PE_ERR_INVALIDCROPVALUE             689
  184. #define PE_ERR_INVALIDCOLLATIONVALUE        690
  185. #define PE_ERR_STARTPAGEGREATERSTOPPAGE     691
  186. #define PE_ERR_INVALIDEXPORTFORMAT          692
  187.  
  188. #define PE_ERR_READONLYPARAMETEROPTION      700 // This parameter option is read only and cannot be changed.
  189. #define PE_ERR_MINGREATERTHANMAX            702 // The minimum cannot be greater than the maximum
  190. #define PE_ERR_INVALIDSTARTPAGE             703 // Specified start page is greater than the last page on the report.
  191. #define PE_ERR_MBCS2UNICODE                 994 // error converting from MBCS to UNICODE
  192. #define PE_ERR_UNICODE2MBCS                 995 // error converting from UNICODE to MBCS
  193. #define PE_ERR_INVALID_PEENUM               996 // some PE_xx_yyyy is not in the specified allowable range.
  194. #define PE_ERR_OTHERERROR                   997
  195. #define PE_ERR_INTERNALERROR                998 // programming error
  196. #define PE_ERR_NOTIMPLEMENTED               999
  197.  
  198. /*************************************/
  199. // unchanged constant
  200. /*************************************/
  201. #define PE_UNCHANGED       -1
  202. #define PE_UNCHANGED_COLOR (PECOLORREF) -2
  203. #define PE_NO_COLOR  (unsigned long) 0xffffffffL
  204.  
  205. #if !defined (CRPE_UNIX)
  206. #   if defined (_WINDLL)
  207. #       define CRPE_API /* __declspec(dllexport) */ WINAPI
  208. #   else
  209. #      define CRPE_API __stdcall
  210. #   endif
  211. #else
  212. #   define CRPE_API
  213. #endif
  214.  
  215.  
  216. /**********************************/
  217. // Open and close print engine
  218. /***********************************/
  219. PEBOOL CRPE_API PEOpenEngine (void);
  220. void CRPE_API PECloseEngine (void);
  221. PEBOOL CRPE_API PECanCloseEngine (void);
  222.  
  223. /*************************************/
  224. // Get version info
  225. /*************************************/
  226. #define PE_GV_DLL     100
  227. #define PE_GV_ENGINE  200
  228.  
  229. short CRPE_API PEGetVersion (short versionRequested);
  230.  
  231. /*********************************************/
  232. // the version number of the .rpt file format
  233. /*********************************************/
  234.  
  235. typedef struct PEVersionInfo
  236. {
  237. #if defined (__cplusplus)
  238.     PEVersionInfo ()
  239.     {
  240.         StructSize = sizeof (PEVersionInfo);
  241.         major = 0;
  242.         minor = 0;
  243.         letter = 0;
  244.     };
  245. #endif
  246.  
  247.     PEWORD StructSize;  // initialize to PE_SIZEOF_VERSION_INFO
  248.     PEWORD major;
  249.     PEWORD minor;
  250.     char letter;
  251. } PEVersionInfo;
  252. #define PE_SIZEOF_VERSION_INFO (sizeof(PEVersionInfo))
  253.  
  254. PEBOOL CRPE_API PEGetReportVersion( short printJob, 
  255.                                   PEVersionInfo FAR* pVersionInfo );
  256.  
  257. /*************************************************************************/
  258. // Open, print and close report (used when no changes needed to report)
  259. /*************************************************************************/
  260. short CRPE_API PEPrintReport (const char FAR *reportFilePath,
  261.                               PEBOOL toDefaultPrinter,
  262.                               PEBOOL toWindow,
  263.                               const char FAR *title,
  264.                               int left,
  265.                               int top,
  266.                               int width,
  267.                               int height,
  268.                               PEDWORD style,
  269.                               PEHWND parentWindow);
  270.  
  271.  
  272. #define PE_RPTOPT_CVTDATETIMETOSTR  0
  273. #define PE_RPTOPT_CVTDATETIMETODATE 1
  274. #define PE_RPTOPT_KEEPDATETIMETYPE  2
  275.  
  276. //Following are the valid values for promptMode
  277. #define PE_RPTOPT_PROMPT_NONE 0
  278. #define PE_RPTOPT_PROMPT_NORMAL 1
  279. #define PE_RPTOPT_PROMPT_ALWAYS 2
  280.  
  281. /*******************************************/
  282. // report options
  283. /********************************************/
  284. typedef struct PEReportOptions
  285. {
  286. #if defined (__cplusplus)
  287.     PEReportOptions ()
  288.     {
  289.         StructSize = sizeof (PEReportOptions);
  290.         saveDataWithReport = PE_UNCHANGED;
  291.         saveSummariesWithReport = PE_UNCHANGED;
  292.         useIndexForSpeed = PE_UNCHANGED;
  293.         translateDOSStrings = PE_UNCHANGED;
  294.         translateDOSMemos = PE_UNCHANGED;
  295.         convertDateTimeType = PE_UNCHANGED;
  296.         convertNullFieldToDefault = PE_UNCHANGED;
  297.         morePrintEngineErrorMessages = PE_UNCHANGED;
  298.         caseInsensitiveSQLData = PE_UNCHANGED;
  299.         verifyOnEveryPrint = PE_UNCHANGED;
  300.         zoomMode = PE_UNCHANGED;
  301.         hasGroupTree = PE_UNCHANGED;
  302.         dontGenerateDataForHiddenObjects = PE_UNCHANGED;
  303.         performGroupingOnServer = PE_UNCHANGED;
  304.         doAsyncQuery = PE_UNCHANGED;
  305.         promptMode = PE_UNCHANGED;
  306.         selectDistinctRecords = PE_UNCHANGED;
  307.         alwaysSortLocally = PE_UNCHANGED;
  308.         isReadOnly = PE_UNCHANGED;
  309.         canSelectDistinctRecords = PE_UNCHANGED;
  310.         useDummyData = PE_UNCHANGED;
  311.         convertAllNullsToDefault = PE_UNCHANGED;
  312.     };
  313. #endif
  314.  
  315.     PEWORD StructSize;  // initialize to PE_SIZEOF_REPORT_OPTIONS
  316.     short saveDataWithReport;  // PEBOOL value, except use PE_UNCHANGED for no change
  317.     short saveSummariesWithReport;  // PEBOOL value, except use PE_UNCHANGED for no change
  318.     short useIndexForSpeed;    // PEBOOL value, except use PE_UNCHANGED for no change
  319.     short translateDOSStrings; // PEBOOL value, except use PE_UNCHANGED for no change
  320.     short translateDOSMemos;   // PEBOOL value, except use PE_UNCHANGED for no change
  321.     short convertDateTimeType; // a PE_RPTOPT_ value, except use PE_UNCHANGED for no change
  322.     short convertNullFieldToDefault; // PEBOOL value, except use PE_UNCHANGED for no change
  323.                                      // This corresponds to 'Convert NULL Values from Database to Default'
  324.     short morePrintEngineErrorMessages;// PEBOOL value, except use PE_UNCHANGED for no change
  325.     short caseInsensitiveSQLData; // PEBOOL value, except use PE_UNCHANGED for no change
  326.     short verifyOnEveryPrint;     // PEBOOL value, except use PE_UNCHAGED for no change
  327.     short zoomMode;                //  a PE_ZOOM_ constant, except use PE_UNCHANGED for no change
  328.     short hasGroupTree;           // PEBOOL value, except use PE_UNCHANGED for no change
  329.     short dontGenerateDataForHiddenObjects; // PEBOOL value, except use PE_UNCHANGED for no change
  330.     short performGroupingOnServer;           // PEBOOL value, except use PE_UNCHANGED for no change
  331.     short doAsyncQuery; // PEBOOL value, except use PE_UNCHANGED for no change
  332.     short promptMode; // PE_RPTOPT_PROMPT_NONE, PE_RPTOPT_PROMPT_NORMAL, PE_RPTOPT_PROMPT_ALWAYS, use PE_UNCHANGED for no change
  333.     short selectDistinctRecords; // PEBOOL value, except use PE_UNCHANGED for no change
  334.     short alwaysSortLocally; // PEBOOL value, except use PE_UNCHANGED for no change
  335.     short isReadOnly; // PEBOOL value,  a read-only attribute.  PESetReportOptions simply ignores it.
  336.     short canSelectDistinctRecords; // PEBOOL value,  a read-only attribute.  PESetReportOptions simply ignore it
  337.     short useDummyData; // PEBOOL value, except use PE_UNCHANGED for no change
  338.     short convertAllNullsToDefault; //  PEBOOL value, except use PE_UNCHANGED for no change
  339. }PEReportOptions;
  340. #define PE_SIZEOF_REPORT_OPTIONS (sizeof(PEReportOptions))
  341.  
  342. PEBOOL CRPE_API PEGetReportOptions (short printJob,
  343.                                   PEReportOptions FAR * reportOptions);
  344. PEBOOL CRPE_API PESetReportOptions (short printJob,
  345.                                   PEReportOptions FAR * reportOptions);
  346.  
  347. /***************************************************/
  348. // print job
  349. /***************************************************/
  350. short CRPE_API PEOpenPrintJob (const char FAR *reportFilePath);
  351. PEBOOL CRPE_API PEClosePrintJob (short printJob);
  352.  
  353. PEBOOL CRPE_API PEStartPrintJob (short printJob,
  354.                                PEBOOL waitUntilDone);
  355. void CRPE_API PECancelPrintJob (short printJob);
  356.  
  357. // open and close subreport
  358. short CRPE_API PEOpenSubreport (short parentJob,
  359.                                 const char FAR *subreportName);
  360. PEBOOL CRPE_API PECloseSubreport (short printJob);
  361.  
  362. // Print job status
  363. // ----------------
  364.  
  365. PEBOOL CRPE_API PEIsPrintJobFinished (short printJob);
  366.  
  367. #define PE_JOBNOTSTARTED 1
  368. #define PE_JOBINPROGRESS 2
  369. #define PE_JOBCOMPLETED  3
  370. #define PE_JOBFAILED     4  // an error occurred
  371. #define PE_JOBCANCELLED  5  // by user
  372. #define PE_JOBHALTED     6  // too many records or too much time
  373.  
  374. typedef struct PEJobInfo
  375. {
  376. #if defined (__cplusplus)
  377.     PEJobInfo ()
  378.     {
  379.         StructSize = sizeof (PEJobInfo);
  380.         NumRecordsRead = 0;
  381.         NumRecordsSelected = 0;
  382.         NumRecordsPrinted = 0;
  383.         DisplayPageN = 0;
  384.         LatestPageN = 0;
  385.         StartPageN = 0;
  386.         printEnded = PEFALSE;
  387.     };
  388. #endif
  389.  
  390.     PEWORD StructSize;    // initialize to PE_SIZEOF_JOB_INFO
  391.  
  392.     PEDWORD NumRecordsRead,
  393.           NumRecordsSelected,
  394.           NumRecordsPrinted;
  395.     PEWORD  DisplayPageN, // the page being displayed in window
  396.           LatestPageN,  // the page being generated
  397.           StartPageN;   // user opted, default to 1
  398.     PEBOOL  printEnded;   // full report print completed?
  399. }PEJobInfo;
  400. #define PE_SIZEOF_JOB_INFO (sizeof (PEJobInfo))
  401.  
  402. short CRPE_API PEGetJobStatus (short printJob,
  403.                                PEJobInfo FAR *jobInfo);
  404.  
  405. /***************************************/
  406. // Controlling dialogs
  407. /***************************************/
  408. PEBOOL CRPE_API PESetDialogParentWindow (short printJob,
  409.                                        PEHWND parentWindow);
  410.  
  411. PEBOOL CRPE_API PEEnableProgressDialog (short printJob,
  412.                                       PEBOOL enable);
  413. /***********************************************/
  414. // Controlling Parameter Field Prompting Dialog
  415. /***********************************************/
  416.  
  417. // Set boolean to indicate whether CRPE is allowed to prompt for parameter values
  418. // during printing.
  419.  
  420. PEBOOL CRPE_API PEGetAllowPromptDialog(short printJob);
  421. PEBOOL CRPE_API PESetAllowPromptDialog(short printJob, PEBOOL showPromptDialog);
  422.  
  423. /*******************************************/
  424. // Print job error codes and messages
  425. /******************************************/
  426.  
  427. short CRPE_API PEGetErrorCode (short printJob);
  428. PEBOOL  CRPE_API PEGetErrorText (short printJob,
  429.                                PEHANDLE FAR *textHandle,
  430.                                short  FAR *textLength);
  431.  
  432. PEBOOL  CRPE_API PEGetHandleString (PEHANDLE textHandle,
  433.                                   char FAR *buffer,
  434.                                   short bufferLength);
  435.  
  436. /*************************************/
  437. // Getting and setting the print date
  438. /*************************************/
  439. PEBOOL CRPE_API PEGetPrintDate (short printJob,
  440.                               short FAR *year,
  441.                               short FAR *month,
  442.                               short FAR *day);
  443.  
  444. PEBOOL CRPE_API PESetPrintDate (short printJob,
  445.                               short year,
  446.                               short month,
  447.                               short day);
  448.  
  449. /********************************************/
  450. // Area, section and group operations
  451. /********************************************/
  452. #define PE_ALLSECTIONS           0
  453.  
  454. // A macro to create section codes:
  455. // (This representation allows up to 25 groups and 40 sections of a given
  456. // type, although Crystal Reports itself has no such limitations.)
  457. #define PE_SECTION_CODE(sectionType,groupN,sectionN) \
  458.     (((sectionType) * 1000) + ((groupN) % 25) + (((sectionN) % 40) * 25))
  459.  
  460. // A macro to create area codes:
  461. #define PE_AREA_CODE(sectionType,groupN) \
  462.     PE_SECTION_CODE (sectionType, groupN, 0)
  463.  
  464. // Section types:
  465. #define PE_SECT_PAGE_HEADER      2
  466. #define PE_SECT_PAGE_FOOTER      7
  467. #define PE_SECT_REPORT_HEADER    1
  468. #define PE_SECT_REPORT_FOOTER    8
  469. #define PE_SECT_GROUP_HEADER     3
  470. #define PE_SECT_GROUP_FOOTER     5
  471. #define PE_SECT_DETAIL           4
  472.  
  473. // Macros to decode section and area codes:
  474. #define PE_SECTION_TYPE(sectionCode) ((sectionCode) / 1000)
  475. #define PE_GROUP_N(sectionCode)      ((sectionCode) % 25)
  476. #define PE_SECTION_N(sectionCode)    (((sectionCode) / 25) % 40)
  477.  
  478. // The old section constants redefined in terms of the new:
  479. // (Note that PE_GRANDTOTALSECTION and PE_SUMMARYSECTION both map
  480. // to PE_SECT_REPORT_FOOTER.)
  481. #define PE_HEADERSECTION      PE_SECTION_CODE (PE_SECT_PAGE_HEADER,   0, 0)
  482. #define PE_FOOTERSECTION      PE_SECTION_CODE (PE_SECT_PAGE_FOOTER,   0, 0)
  483. #define PE_TITLESECTION       PE_SECTION_CODE (PE_SECT_REPORT_HEADER, 0, 0)
  484. #define PE_SUMMARYSECTION     PE_SECTION_CODE (PE_SECT_REPORT_FOOTER, 0, 0)
  485. #define PE_GROUPHEADER        PE_SECTION_CODE (PE_SECT_GROUP_HEADER,  0, 0)
  486. #define PE_GROUPFOOTER        PE_SECTION_CODE (PE_SECT_GROUP_FOOTER,  0, 0)
  487. #define PE_DETAILSECTION      PE_SECTION_CODE (PE_SECT_DETAIL,        0, 0)
  488. #define PE_GRANDTOTALSECTION  PE_SUMMARYSECTION
  489.  
  490. // Controlling group conditions (i.e. group breaks)
  491. #define PE_SF_MAX_NAME_LENGTH 50
  492.  
  493. #define PE_SF_DESCENDING 0
  494. #define PE_SF_ASCENDING  1
  495. #define PE_SF_ORIGINAL   2 // only for group condition
  496. #define PE_SF_SPECIFIED  3 // only for group condition
  497.  
  498.  
  499. // use PE_ANYCHANGE for all field types except Date
  500. #define PE_GC_ANYCHANGE    0
  501.  
  502. // use these constants for Date and DateTime fields
  503. #define PE_GC_DAILY        0
  504. #define PE_GC_WEEKLY       1
  505. #define PE_GC_BIWEEKLY     2
  506. #define PE_GC_SEMIMONTHLY  3
  507. #define PE_GC_MONTHLY      4
  508. #define PE_GC_QUARTERLY    5
  509. #define PE_GC_SEMIANNUALLY 6
  510. #define PE_GC_ANNUALLY     7
  511.  
  512. // use these constants for Time  and DateTime fields
  513. #define PE_GC_BYSECOND     8
  514. #define PE_GC_BYMINUTE     9
  515. #define PE_GC_BYHOUR       10
  516. #define PE_GC_BYAMPM       11
  517.  
  518. // use these constants for Boolean fields
  519. #define PE_GC_TOYES        1
  520. #define PE_GC_TONO         2
  521. #define PE_GC_EVERYYES     3
  522. #define PE_GC_EVERYNO      4
  523. #define PE_GC_NEXTISYES    5
  524. #define PE_GC_NEXTISNO     6
  525.  
  526. PEBOOL CRPE_API PESetGroupCondition (short printJob,
  527.                                    short sectionCode,
  528.                                    const char FAR *conditionField, // formula form
  529.                                    short condition,       // a PE_GC_ constant
  530.                                    short sortDirection);  // a PE_SF_ constant
  531.  
  532. short CRPE_API PEGetNGroups (short printJob);  // return -1 if failed.
  533.  
  534.  
  535. // for PEGetGroupCondition, condition encodes both
  536. // the condition and the type of the condition field
  537. #define PE_GC_CONDITIONMASK   0x00FF
  538. #define PE_GC_TYPEMASK        0x0F00
  539.  
  540. #define PE_GC_TYPEOTHER       0x0000
  541. #define PE_GC_TYPEDATE        0x0200
  542. #define PE_GC_TYPEBOOLEAN     0x0400
  543. #define PE_GC_TYPETIME        0x0800
  544.  
  545. PEBOOL CRPE_API PEGetGroupCondition (short printJob,
  546.                                    short sectionCode,
  547.                                    PEHANDLE FAR *conditionFieldHandle,
  548.                                    short  FAR *conditionFieldLength,
  549.                                    short  FAR *condition,
  550.                                    short  FAR *sortDirection);
  551.  
  552. #define PE_FIELD_NAME_LEN 512
  553.  
  554. #define PE_GO_TBN_ALL_GROUPS_UNSORTED   0
  555. #define PE_GO_TBN_ALL_GROUPS_SORTED     1
  556. #define PE_GO_TBN_TOP_N_GROUPS          2
  557. #define PE_GO_TBN_BOTTOM_N_GROUPS       3
  558.  
  559. typedef struct PEGroupOptions
  560. {
  561. #if defined (__cplusplus)
  562.     PEGroupOptions ()
  563.     {
  564.         StructSize = sizeof (PEGroupOptions);
  565.         condition = PE_UNCHANGED;
  566.         fieldName [0] = '\0';
  567.         sortDirection = PE_UNCHANGED;
  568.         repeatGroupHeader = PE_UNCHANGED;
  569.         keepGroupTogether = PE_UNCHANGED;
  570.         topOrBottomNGroups = PE_UNCHANGED;
  571.         topOrBottomNSortFieldName [0] = '\0';
  572.         nTopOrBottomGroups = PE_UNCHANGED;
  573.         discardOtherGroups = PE_UNCHANGED;
  574.         hierarchicalSorting = PE_UNCHANGED;
  575.         instanceIDField [0] = '\0';
  576.         parentIDField [0] = '\0';
  577.         groupIndent = PE_UNCHANGED;
  578.         customizeGroupName = PE_UNCHANGED;
  579.         notInTopOrBottomNName [0] = '\0';
  580.     };
  581. #endif
  582.  
  583.     PEWORD    StructSize;
  584.      // when setting, pass a PE_GC_ constant, or PE_UNCHANGED for no change.
  585.     // when getting, use PE_GC_TYPEMASK and PE_GC_CONDITIONMASK to
  586.     // decode the condition.
  587.     short   condition;
  588.     char    fieldName [PE_FIELD_NAME_LEN]; // formula form, or empty for no change.
  589.     short   sortDirection;                // a PE_SF_ const, or PE_UNCHANGED for no change.
  590.     short   repeatGroupHeader;            // PEBOOL value, or PE_UNCHANGED for no change.
  591.     short   keepGroupTogether;            // PEBOOL value, or PE_UNCHANGED for no change.
  592.     short   topOrBottomNGroups;           // a PE_GO_TBN_ constant, or PE_UNCHANGED for no change.
  593.     char    topOrBottomNSortFieldName [PE_FIELD_NAME_LEN]; // formula form, or empty for no change.
  594.     short   nTopOrBottomGroups;           // the number of groups to keep, 0 for all, or PE_UNCHANGED for no change.
  595.     short   discardOtherGroups;           // PEBOOL value, or PE_UNCHANGED for no change.
  596.     short   ignored;                                // for 4 byte alignment. ignored.
  597.     short   hierarchicalSorting;                    // Boolean or PE_UNCHANGED
  598.     char    instanceIDField [PE_FIELD_NAME_LEN];    // for hierarchical grouping
  599.     char    parentIDField [PE_FIELD_NAME_LEN];      // for hierarchical grouping
  600.     long    groupIndent;                            // twips
  601.     short   customizeGroupName;               //PEBOOL or PE_UNCHANGED
  602.     char    notInTopOrBottomNName [PE_FIELD_NAME_LEN]; // empty for no change.
  603. }
  604.     PEGroupOptions;
  605. #define PE_SIZEOF_GROUP_OPTIONS (sizeof (PEGroupOptions))
  606.  
  607. PEBOOL CRPE_API PEGetGroupOptions(short printJob,
  608.                                 short groupN,
  609.                                 PEGroupOptions FAR * groupOptions);
  610. PEBOOL CRPE_API PESetGroupOptions(short printJob,
  611.                                 short groupN,
  612.                                 PEGroupOptions FAR * groupOptions);
  613.  
  614. //Get number of sections
  615. short CRPE_API PEGetNSections (short printJob); // return -1 if failed
  616. short CRPE_API PEGetNSectionsInArea(short printJob, short areaCode); // return -1 if failed
  617.  
  618. short CRPE_API PEGetSectionCode (short printJob,  // return 0 if failed
  619.                                  short sectionN); // range within the number from PEGetNSections
  620.  
  621. // Setting section/area height
  622. // This is the replacement API Call for PEGetMinimumSectionHeight which is obsolete.
  623. // The obsolete API will still work for older applications, but use this for all new development
  624. PEBOOL CRPE_API PEGetSectionHeight(short printJob,
  625.                                  short sectionCode,
  626.                                  short FAR * height); // Twips
  627.  
  628. // This is the replacement API Call for PESetMinimumSectionHeight which is obsolete.
  629. // The obsolete API will still work for older applications, but use this for all new development
  630. PEBOOL CRPE_API PESetSectionHeight (short printJob,
  631.                                   short sectionCode,
  632.                                   short height); // twips
  633.  
  634. // area or section format.
  635. typedef struct PESectionOptions // For area options, too.
  636. {
  637. #if defined (__cplusplus)
  638.     PESectionOptions ()
  639.     {
  640.         StructSize = sizeof (PESectionOptions);
  641.         visible = PE_UNCHANGED;
  642.         newPageBefore = PE_UNCHANGED;
  643.         newPageAfter = PE_UNCHANGED;
  644.         keepTogether = PE_UNCHANGED;
  645.         suppressBlankSection = PE_UNCHANGED;
  646.         resetPageNAfter = PE_UNCHANGED;
  647.         printAtBottomOfPage = PE_UNCHANGED;
  648.         backgroundColor = PE_UNCHANGED_COLOR;
  649.         underlaySection = PE_UNCHANGED;
  650.         showArea = PE_UNCHANGED;
  651.         freeFormPlacement = PE_UNCHANGED;
  652.         reserveMinimumPageFooter = PE_UNCHANGED;
  653.         hCssClass = 0;
  654.         cssClassLen = PE_UNCHANGED;
  655.     };
  656. #endif
  657.  
  658.     PEWORD StructSize;            // initialize to PE_SIZEOF_SECTION_OPTIONS
  659.  
  660.     short visible,              // PEBOOL values, except use PE_UNCHANGED
  661.           newPageBefore,        // to preserve the existing settings
  662.           newPageAfter,
  663.           keepTogether,
  664.           suppressBlankSection,
  665.           resetPageNAfter,
  666.           printAtBottomOfPage;
  667.     PECOLORREF backgroundColor;   // Use PE_UNCHANGED_COLOR to preserve the
  668.                                 // existing color. only for section format
  669.     short underlaySection;      // PEBOOL values, except use PE_UNCHANGED
  670.     short showArea;             // to preserve the existing settings
  671.     short freeFormPlacement;
  672.     short reserveMinimumPageFooter;   // choose the maximum visible page footer section 
  673.                                       // as reserve.
  674.     PEHANDLE  hCssClass;            // handle to styleclass contents (string).
  675.     short   cssClassLen;          // length in bytes of hStyleClass,
  676. }PESectionOptions;
  677. #define PE_SIZEOF_SECTION_OPTIONS (sizeof (PESectionOptions))
  678.  
  679. PEBOOL CRPE_API PESetSectionFormat (short printJob,
  680.                                   short sectionCode,
  681.                                   PESectionOptions FAR *options);
  682.  
  683. PEBOOL CRPE_API PEGetSectionFormat (short printJob,
  684.                                   short sectionCode,
  685.                                   PESectionOptions FAR *options);
  686.  
  687. PEBOOL CRPE_API PESetAreaFormat (short printJob,
  688.                                short areaCode,
  689.                                PESectionOptions FAR *options);
  690.  
  691. PEBOOL CRPE_API PEGetAreaFormat (short printJob,
  692.                                short areaCode,
  693.                                PESectionOptions FAR *options);
  694.  
  695. // Setting font and color info
  696. #define PE_FIELDS    0x0001
  697. #define PE_TEXT      0x0002
  698.  
  699. PEBOOL CRPE_API PESetFont (short printJob,
  700.                          short sectionCode,
  701.                          short scopeCode,     // PE_FIELDS or PE_TEXT
  702.                          const char FAR *faceName,  // 0 for no change
  703.                          short fontFamily,    // PE_FF_DONTCARE for no change
  704.                          short fontPitch,     // PE_DEFAULT_PITCH for no change
  705.                          short charSet,       // PE_DEFAULT_CHARSET for no change
  706.                          short pointSize,     // 0 for no change
  707.                          short isItalic,      // PE_UNCHANGED for no change
  708.                          short isUnderlined,  // ditto
  709.                          short isStruckOut,   // ditto
  710.                          short weight);       // 0 for no change
  711.  
  712. // Subreport object
  713. short CRPE_API PEGetNSubreportsInSection (short printJob,
  714.                                           short sectionCode);
  715.  
  716. PEDWORD CRPE_API PEGetNthSubreportInSection (short printJob,
  717.                                            short sectionCode,
  718.                                            short subreportN);
  719.  
  720. #define PE_SUBREPORT_NAME_LEN 128
  721. // PE_SRI_ONOPENJOB: Reimport the subreport when opening the main report.
  722. // PE_SRI_ONFUNCTIONCALL: Reimport the subreport when the api is called.
  723. #define PE_SRI_UNDEFINED     -1
  724. #define PE_SRI_ONOPENJOB      0
  725. #define PE_SRI_ONFUNCTIONCALL 1
  726.  
  727. typedef struct PESubreportInfo
  728. {
  729. #if defined (__cplusplus)
  730.     PESubreportInfo ()
  731.     {
  732.         StructSize = sizeof (PESubreportInfo);
  733.         name [0] = '\0';
  734.         NLinks = 0;
  735.         isOnDemand = PE_UNCHANGED;
  736.         external = PE_UNCHANGED;
  737.         reimportOption = PE_UNCHANGED;
  738.     };
  739. #endif
  740.  
  741.     PEWORD StructSize;            // Initialize to PE_SIZEOF_SUBREPORT_INFO.
  742.     // Strings are null-terminated.
  743.     char name [PE_SUBREPORT_NAME_LEN];
  744.  
  745.     // number of links
  746.     short NLinks;
  747.     // subreport placement.
  748.     short isOnDemand;    // PETRUE if the subreport is on demand subreport.
  749.     
  750.     short external;         // 1: the subreport is imported; 0: otherwise.
  751.     short reimportOption;   // PE_SRI_ONOPENJOB or PE_SRI_ONFUNCTIONCALL
  752.                             // This value is ignored if the subreport is
  753.                             // not imported (value of external is 0).
  754. } PESubreportInfo;
  755. #define PE_SIZEOF_SUBREPORT_INFO (sizeof (PESubreportInfo))
  756.  
  757. PEBOOL CRPE_API PEGetSubreportInfo (short printJob,
  758.                                   PEDWORD subreportHandle,
  759.                                   PESubreportInfo FAR *subreportInfo);
  760.  
  761. PEBOOL CRPE_API PEReimportSubreport(short printJob,
  762.                                   PEDWORD subreportHandle,
  763.                                   PEBOOL FAR * linkChanged,
  764.                                   PEBOOL FAR * reimported);
  765.  
  766. /* *************************************** */
  767. /*        GRAPHING                         */
  768. /* *************************************** */
  769. //graph type
  770.  
  771. #define PE_GT_BARCHART              0
  772. #define PE_GT_LINECHART             1
  773. #define PE_GT_AREACHART             2
  774. #define PE_GT_PIECHART              3
  775. #define PE_GT_DOUGHNUTCHART         4
  776. #define PE_GT_THREEDRISERCHART      5
  777. #define PE_GT_THREEDSURFACECHART    6
  778. #define PE_GT_SCATTERCHART          7
  779. #define PE_GT_RADARCHART            8
  780. #define PE_GT_BUBBLECHART           9
  781. #define PE_GT_STOCKCHART            10
  782. #define PE_GT_USERDEFINEDCHART      50      // <----|__ for PEGetGraphTypeInfo only - 
  783. #define PE_GT_UNKNOWNTYPECHART      100     // <----|   do not use in PESetGraphTypeInfo.
  784.  
  785.  
  786. // graph subtype
  787. // bar charts
  788. #define PE_GST_SIDEBYSIDEBARCHART                   0
  789. #define PE_GST_STACKEDBARCHART                      1
  790. #define PE_GST_PERCENTBARCHART                      2
  791. #define PE_GST_FAKED3DSIDEBYSIDEBARCHART            3
  792. #define PE_GST_FAKED3DSTACKEDBARCHART               4
  793. #define PE_GST_FAKED3DPERCENTBARCHART               5
  794.                                                     
  795. // line charts                                      
  796. #define PE_GST_REGULARLINECHART                     10
  797. #define PE_GST_STACKEDLINECHART                     11
  798. #define PE_GST_PERCENTAGELINECHART                  12
  799. #define PE_GST_LINECHARTWITHMARKERS                 13
  800. #define PE_GST_STACKEDLINECHARTWITHMARKERS          14
  801. #define PE_GST_PERCENTAGELINECHARTWITHMARKERS       15
  802.                                                     
  803. //area charts                                       
  804. #define PE_GST_ABSOLUTEAREACHART                    20
  805. #define PE_GST_STACKEDAREACHART                     21
  806. #define PE_GST_PERCENTAREACHART                     22
  807. #define PE_GST_FAKED3DABSOLUTEAREACHART             23
  808. #define PE_GST_FAKED3DSTACKEDAREACHART              24
  809. #define PE_GST_FAKED3DPERCENTAREACHART              25
  810.                                                     
  811. // pie charts                                       
  812. #define PE_GST_REGULARPIECHART                      30
  813. #define PE_GST_FAKED3DREGULARPIECHART               31
  814. #define PE_GST_MULTIPLEPIECHART                     32
  815. #define PE_GST_MULTIPLEPROPORTIONALPIECHART         33
  816.                                                     
  817. // doughnut charts                                  
  818. #define PE_GST_REGULARDOUGHNUTCHART                 40
  819. #define PE_GST_MULTIPLEDOUGHNUTCHART                41
  820. #define PE_GST_MULTIPLEPROPORTIONALDOUGHNUTCHART    42
  821.  
  822. // 3D riser charts
  823. #define PE_GST_THREEDREGULARCHART                   50
  824. #define PE_GST_THREEDPYRAMIDCHART                   51
  825. #define PE_GST_THREEDOCTAGONCHART                   52
  826. #define PE_GST_THREEDCUTCORNERSCHART                53
  827.                                                     
  828. // 3D surface charts                                
  829. #define PE_GST_THREEDSURFACEREGULARCHART            60
  830. #define PE_GST_THREEDSURFACEWITHSIDESCHART          61
  831. #define PE_GST_THREEDSURFACEHONEYCOMBCHART          62
  832.                                                     
  833. // scatter charts                                   
  834. #define PE_GST_XYSCATTERCHART                       70
  835. #define PE_GST_XYSCATTERDUALAXISCHART               71
  836. #define PE_GST_XYSCATTERWITHLABELSCHART             72
  837. #define PE_GST_XYSCATTERDUALAXISWITHLABELSCHART     73
  838.                                                     
  839. // radar charts                                     
  840. #define PE_GST_REGULARRADARCHART                    80
  841. #define PE_GST_STACKEDRADARCHART                    81
  842. #define PE_GST_RADARDUALAXISCHART                   82
  843.                                                     
  844. // bubble charts                                    
  845. #define PE_GST_REGULARBUBBLECHART                   90
  846. #define PE_GST_DUALAXISBUBBLECHART                  91
  847.                                                     
  848. // stocked charts                                   
  849. #define PE_GST_HIGHLOWCHART                         100
  850. #define PE_GST_HIGHLOWOPENCLOSECHART                101
  851.                                                     
  852. #define PE_GST_UNKNOWNSUBTYPECHART                  1000
  853.  
  854. typedef struct PEGraphTypeInfo
  855. {
  856. #if defined (__cplusplus)
  857.     PEGraphTypeInfo ()
  858.     {
  859.         StructSize = sizeof (PEGraphTypeInfo);
  860.         graphType = PE_UNCHANGED;
  861.         graphSubtype = PE_UNCHANGED;
  862.     };
  863. #endif
  864.  
  865.     PEWORD StructSize;
  866.     short graphType;      // PE_GT_*, PE_UNCHANGED for no change
  867.     short graphSubtype;   // PE_GST_*, PE_UNCHANGED for no change
  868.  
  869. } PEGraphTypeInfo;
  870.  
  871. #define PE_SIZEOF_GRAPH_TYPE_INFO (sizeof (PEGraphTypeInfo))
  872.  
  873. PEBOOL CRPE_API PEGetGraphTypeInfo(short printJob, 
  874.                                  short sectionN, 
  875.                                  short graphN, 
  876.                                  PEGraphTypeInfo FAR * graphTypeInfo);
  877.  
  878. PEBOOL CRPE_API PESetGraphTypeInfo(short printJob, 
  879.                                  short sectionN, 
  880.                                  short graphN, 
  881.                                  PEGraphTypeInfo FAR * graphTypeInfo);
  882.  
  883.  
  884. // graph text
  885. #define PE_GTT_TITLE            0
  886. #define PE_GTT_SUBTITLE         1
  887. #define PE_GTT_FOOTNOTE         2
  888. #define PE_GTT_SERIESTITLE      3
  889. #define PE_GTT_GROUPSTITLE      4
  890. #define PE_GTT_XAXISTITLE       5
  891. #define PE_GTT_YAXISTITLE       6
  892. #define PE_GTT_ZAXISTITLE       7
  893.  
  894. // graph text fonts
  895. #define PE_GTF_TITLEFONT        0
  896. #define PE_GTF_SUBTITLEFONT     1
  897. #define PE_GTF_FOOTNOTEFONT     2
  898. #define PE_GTF_GROUPSTITLEFONT  3
  899. #define PE_GTF_DATATITLEFONT    4
  900. #define PE_GTF_LEGENDFONT       5
  901. #define PE_GTF_GROUPLABELSFONT  6
  902. #define PE_GTF_DATALABELSFONT   7
  903.  
  904. #define PE_FACE_NAME_LEN 64
  905. typedef struct PEFontColorInfo
  906. {
  907. #if defined (__cplusplus)
  908.     PEFontColorInfo ()
  909.     {
  910.         StructSize = sizeof (PEFontColorInfo);
  911.         faceName[0] = '\0';
  912.         fontFamily = PE_FF_DONTCARE;
  913.         fontPitch = PE_DEFAULT_PITCH;
  914.         charSet = PE_DEFAULT_CHARSET;
  915.         pointSize = 0;
  916.         isItalic = PE_UNCHANGED;
  917.         isUnderlined = PE_UNCHANGED;
  918.         isStruckOut = PE_UNCHANGED;
  919.         weight = 0;
  920.         color = PE_UNCHANGED_COLOR;
  921.         twipSize = 0;
  922.     };
  923. #endif
  924.  
  925.     PEWORD StructSize;
  926.     char faceName[PE_FACE_NAME_LEN]; // empty string for no change
  927.     short fontFamily; // PE_FF_DONTCARE for no change
  928.     short fontPitch;  // PE_DEFAULT_PITCH for no change
  929.     short charSet;   // PE_DEFAULT_CHARSET for no change
  930.     short pointSize;  // 0 for no change
  931.     short isItalic;   // PEBOOL value, except use PE_UNCHANGED for no change.
  932.     short isUnderlined; // PEBOOL value, except use PE_UNCHANGED for no change.
  933.     short isStruckOut;  // PEBOOL value, except use PE_UNCHANGED for no change.
  934.     short weight;       // 0 for no change
  935.     PECOLORREF color;     // PE_UNCHANGED_COLOR for no change.
  936.     short twipSize;     // Font size in twips, 0 for no change.
  937.                         // Use one of pointSize or twipSize. If both pointSize and twipSize
  938.                         // are non-zero, twipSize will be used and pointSize will be ignored.
  939. }PEFontColorInfo;
  940. #define PE_SIZEOF_FONT_COLOR_INFO (sizeof(PEFontColorInfo))
  941.  
  942. PEBOOL CRPE_API PEGetGraphTextInfo(short printJob, 
  943.                                  short sectionN, 
  944.                                  short graphN, 
  945.                                  PEWORD titleType,     //PE_GTT_*
  946.                                  PEHANDLE FAR * title, 
  947.                                  short FAR * titleLength);
  948.  
  949. PEBOOL CRPE_API PESetGraphTextInfo(short printJob, 
  950.                                  short sectionN, 
  951.                                  short graphN, 
  952.                                  PEWORD titleType, 
  953.                                  const char FAR * title);
  954.  
  955. //enable/disable graph default titles
  956. PEBOOL CRPE_API PESetGraphTextDefaultOption (short printJob,
  957.                                     short sectionN, 
  958.                                     short graphN, 
  959.                                     PEWORD titleType,     //PE_GTT_*
  960.                                     PEBOOL useDefault);
  961.  
  962. PEBOOL CRPE_API PEGetGraphTextDefaultOption (short printJob,
  963.                                     short sectionN, 
  964.                                     short graphN, 
  965.                                     PEWORD titleType,     //PE_GTT_*
  966.                                     PEBOOL FAR * useDefault);
  967.  
  968.  
  969. //graph font
  970. PEBOOL CRPE_API PEGetGraphFontInfo(short printJob, 
  971.                                  short sectionN, 
  972.                                  short graphN, 
  973.                                  PEWORD titleFontType,  //PE_GTF_
  974.                                  PEFontColorInfo FAR * fontColourInfo);
  975.  
  976. PEBOOL CRPE_API PESetGraphFontInfo(short printJob, 
  977.                                  short sectionN, 
  978.                                  short graphN, 
  979.                                  PEWORD titleFontType,  //PE_GTF_
  980.                                  PEFontColorInfo FAR * fontColourInfo);
  981.  
  982. // graph options
  983. #define PE_GLP_PLACEUPPERRIGHT      0
  984. #define PE_GLP_PLACEBOTTOMCENTER    1
  985. #define PE_GLP_PLACETOPCENTER       2
  986. #define PE_GLP_PLACERIGHT           3
  987. #define PE_GLP_PLACELEFT            4
  988. #define PE_GLP_PLACECUSTOM          5   // for PEGetGraphOptionInfo, do not use
  989.                                         // in PESetGraphOptionInfo.
  990.  
  991. //legend layout
  992. #define PE_GLL_PERCENTAGE           0
  993. #define PE_GLL_AMOUNT               1
  994. #define PE_GLL_CUSTOM               2   // for PEGetGraphOptionInfo, do not use
  995.                                         // in PESetGraphOptionInfo.
  996.  
  997. // bar sizes
  998. #define PE_GBS_MINIMUMBARSIZE       0
  999. #define PE_GBS_SMALLBARSIZE         1
  1000. #define PE_GBS_AVERAGEBARSIZE       2
  1001. #define PE_GBS_LARGEBARSIZE         3
  1002. #define PE_GBS_MAXIMUMBARSIZE       4
  1003.  
  1004. // pie sizes
  1005. #define PE_GPS_MINIMUMPIESIZE       64
  1006. #define PE_GPS_SMALLPIESIZE         48
  1007. #define PE_GPS_AVERAGEPIESIZE       32
  1008. #define PE_GPS_LARGEPIESIZE         16
  1009. #define PE_GPS_MAXIMUMPIESIZE       0
  1010.  
  1011. // detached pie slice
  1012. #define PE_GDPS_NODETACHMENT        0
  1013. #define PE_GDPS_SMALLESTSLICE       1
  1014. #define PE_GDPS_LARGESTSLICE        2
  1015.  
  1016. // marker sizes
  1017. #define PE_GMS_SMALLMARKERS         0
  1018. #define PE_GMS_MEDIUMSMALLMARKERS   1
  1019. #define PE_GMS_MEDIUMMARKERS        2
  1020. #define PE_GMS_MEDIUMLARGEMARKERS   3
  1021. #define PE_GMS_LARGEMARKERS         4
  1022.  
  1023. // marker shapes
  1024. #define PE_GMSP_RECTANGLESHAPE      1
  1025. #define PE_GMSP_CIRCLESHAPE         4
  1026. #define PE_GMSP_DIAMONDSHAPE        5
  1027. #define PE_GMSP_TRIANGLESHAPE       8
  1028.  
  1029. // chart color
  1030. #define PE_GCR_COLORCHART           0
  1031. #define PE_GCR_BLACKANDWHITECHART   1
  1032.  
  1033. // chart data points
  1034. #define PE_GDP_NONE                 0
  1035. #define PE_GDP_SHOWLABEL            1
  1036. #define PE_GDP_SHOWVALUE            2
  1037.  
  1038. // number formats
  1039. #define PE_GNF_NODECIMAL            0
  1040. #define PE_GNF_ONEDECIMAL           1
  1041. #define PE_GNF_TWODECIMAL           2
  1042. #define PE_GNF_CURRENCYNODECIMAL    3
  1043. #define PE_GNF_CURRENCYTWODECIMAL   4
  1044. #define PE_GNF_PERCENTNODECIMAL     5
  1045. #define PE_GNF_PERCENTONEDECIMAL    6
  1046. #define PE_GNF_PERCENTTWODECIMAL    7
  1047.  
  1048. // viewing angles
  1049. #define PE_GVA_STANDARDVIEW         1
  1050. #define PE_GVA_TALLVIEW             2
  1051. #define PE_GVA_TOPVIEW              3
  1052. #define PE_GVA_DISTORTEDVIEW        4
  1053. #define PE_GVA_SHORTVIEW            5
  1054. #define PE_GVA_GROUPEYEVIEW         6
  1055. #define PE_GVA_GROUPEMPHASISVIEW    7
  1056. #define PE_GVA_FEWSERIESVIEW        8
  1057. #define PE_GVA_FEWGROUPSVIEW        9
  1058. #define PE_GVA_DISTORTEDSTDVIEW     10
  1059. #define PE_GVA_THICKGROUPSVIEW      11
  1060. #define PE_GVA_SHORTERVIEW          12
  1061. #define PE_GVA_THICKSERIESVIEW      13
  1062. #define PE_GVA_THICKSTDVIEW         14
  1063. #define PE_GVA_BIRDSEYEVIEW         15
  1064. #define PE_GVA_MAXVIEW              16
  1065.  
  1066. typedef struct PEGraphOptionInfo
  1067. {
  1068. #if defined (__cplusplus)
  1069.     PEGraphOptionInfo ()
  1070.     {
  1071.         StructSize = sizeof (PEGraphOptionInfo);
  1072.         graphColour = PE_UNCHANGED;
  1073.         showLegend = PE_UNCHANGED;
  1074.         legendPosition = PE_UNCHANGED;
  1075.         pieSize = PE_UNCHANGED;
  1076.         detachedPieSlice = PE_UNCHANGED;
  1077.         barSize = PE_UNCHANGED;
  1078.         verticalBars = PE_UNCHANGED;
  1079.         markerSize = PE_UNCHANGED;
  1080.         markerShape = PE_UNCHANGED;
  1081.         dataPoints = PE_UNCHANGED;
  1082.         dataValueNumberFormat = PE_UNCHANGED;
  1083.         viewingAngle = PE_UNCHANGED;
  1084.         legendLayout = PE_UNCHANGED;
  1085.     };
  1086. #endif
  1087.  
  1088.     PEWORD StructSize;
  1089.  
  1090.     short graphColour; // PE_GCR_*, PE_UNCHANGED for no change
  1091.  
  1092.     short showLegend; //PEBOOL, PE_UNCHANGED for no change
  1093.     short legendPosition; //PE_GLP_*, if showLegend == 0, means no legend 
  1094.  
  1095. // pie charts and doughut charts
  1096.     short pieSize; // PE_GPS_*, PE_UNCHANGED for no change
  1097.     short detachedPieSlice; // PE_GDPS_*, PE_UNCHANGED for no change
  1098.  
  1099. // bar chart
  1100.     short barSize; // PE_GBS_*, PE_UNCHANGED for no change
  1101.     short verticalBars; //PEBOOL, PE_UNCHANGED for no change
  1102.  
  1103. // markers (used for line and bar charts)
  1104.     short markerSize; // PE_GMS_*, PE_UNCHANGED for no change
  1105.     short markerShape; // PE_GMSP_*, PE_UNCHANGED for no change
  1106.  
  1107. //data points
  1108.     short dataPoints; // PE_GDP_*, PE_UNCHANGED for no change    
  1109.     short dataValueNumberFormat; //PE_GNF_*, PE_UNCHANGED for no change
  1110.  
  1111. // 3d
  1112.     short viewingAngle; //PE_GVA_*, PE_UNCHANGED for no change
  1113.  
  1114.     short legendLayout;     //PE_GLL_*
  1115.  
  1116. } PEGraphOptionInfo;
  1117.  
  1118. #define PE_SIZEOF_GRAPH_OPTION_INFO (sizeof (PEGraphOptionInfo))
  1119.  
  1120.  
  1121. PEBOOL CRPE_API PEGetGraphOptionInfo(short printJob, 
  1122.                                    short sectionN, 
  1123.                                    short graphN, 
  1124.                                    PEGraphOptionInfo FAR * graphOptionInfo);
  1125.  
  1126. PEBOOL CRPE_API PESetGraphOptionInfo(short printJob, 
  1127.                                    short sectionN, 
  1128.                                    short graphN,
  1129.                                    PEGraphOptionInfo FAR * graphOptionInfo);
  1130.  
  1131. //graph axes
  1132. #define PE_GGT_NOGRIDLINES              0
  1133. #define PE_GGT_MINORGRIDLINES           1
  1134. #define PE_GGT_MAJORGRIDLINES           2
  1135. #define PE_GGT_MAJORANDMINORGRIDLINES   3
  1136.  
  1137. //axis division method
  1138. #define PE_ADM_AUTOMATIC                0
  1139. #define PE_ADM_MANUAL                   1
  1140.  
  1141. typedef struct PEGraphAxisInfo
  1142. {
  1143. #if defined (__cplusplus)
  1144.     PEGraphAxisInfo ()
  1145.     {
  1146.         StructSize = sizeof (PEGraphAxisInfo);
  1147.         groupAxisGridLine = PE_UNCHANGED;
  1148.         dataAxisYGridLine = PE_UNCHANGED;
  1149.         dataAxisY2GridLine = PE_UNCHANGED;
  1150.         seriesAxisGridline = PE_UNCHANGED;
  1151.         dataAxisYMinValue = 0;
  1152.         dataAxisYMaxValue = 0;
  1153.         dataAxisY2MinValue = 0;
  1154.         dataAxisY2MaxValue = 0;
  1155.         seriesAxisMinValue = 0;
  1156.         seriesAxisMaxValue = 0;
  1157.         dataAxisYNumberFormat = PE_UNCHANGED;
  1158.         dataAxisY2NumberFormat = PE_UNCHANGED;
  1159.         seriesAxisNumberFormat = PE_UNCHANGED;
  1160.         dataAxisYAutoRange = PE_UNCHANGED;
  1161.         dataAxisY2AutoRange = PE_UNCHANGED;
  1162.         seriesAxisAutoRange = PE_UNCHANGED;
  1163.         dataAxisYAutomaticDivision = PE_UNCHANGED;
  1164.         dataAxisY2AutomaticDivision = PE_UNCHANGED;
  1165.         seriesAxisAutomaticDivision = PE_UNCHANGED;
  1166.         dataAxisYManualDivision = PE_UNCHANGED;
  1167.         dataAxisY2ManualDivision = PE_UNCHANGED;
  1168.         seriesAxisManualDivision = PE_UNCHANGED;
  1169.         dataAxisYAutoScale = PE_UNCHANGED;
  1170.         dataAxisY2AutoScale = PE_UNCHANGED;
  1171.         seriesAxisAutoScale = PE_UNCHANGED;
  1172.     };
  1173. #endif
  1174.  
  1175.     PEWORD StructSize;
  1176.  
  1177.     short groupAxisGridLine; // PE_GGT_*, PE_UNCHANGED for no change
  1178.     short dataAxisYGridLine; // PE_GGT_*, PE_UNCHANGED for no change
  1179.     short dataAxisY2GridLine; // PE_GGT_*, PE_UNCHANGED for no change
  1180.     short seriesAxisGridline; // PE_GGT_*, PE_UNCHANGED for no change
  1181.  
  1182.     double dataAxisYMinValue;
  1183.     double dataAxisYMaxValue;
  1184.     double dataAxisY2MinValue;
  1185.     double dataAxisY2MaxValue;
  1186.     double seriesAxisMinValue;
  1187.     double seriesAxisMaxValue;
  1188.  
  1189.     short dataAxisYNumberFormat; //PE_GNF_*, PE_UNCHANGED for no change
  1190.     short dataAxisY2NumberFormat; //PE_GNF_*, PE_UNCHANGED for no change
  1191.     short seriesAxisNumberFormat; //PE_GNF_*, PE_UNCHANGED for no change
  1192.  
  1193.     short dataAxisYAutoRange; // PEBOOL, PE_UNCHANGED for no change
  1194.     short dataAxisY2AutoRange; //PEBOOL, PE_UNCHANGED for no change
  1195.     short seriesAxisAutoRange; //PEBOOL, PE_UNCHANGED for no change
  1196.  
  1197.     short dataAxisYAutomaticDivision; // PE_ADM_* or PE_UNCHANGED for no change
  1198.     short dataAxisY2AutomaticDivision; // PE_ADM_* or PE_UNCHANED for no change
  1199.     short seriesAxisAutomaticDivision; // PE_ADM_* or PE_UNCHANED for no change
  1200.  
  1201.     long dataAxisYManualDivision;  //if dataAxisYAutomaticDivision is PE_ADM_AUTOMATIC, this field is ignored
  1202.     long dataAxisY2ManualDivision; //if dataAxisY2AutomaticDivision is PE_ADM_AUTOMATIC, this field is ignored
  1203.     long seriesAxisManualDivision; //if seriesAxisAutomaticDivision is PE_ADM_AUTOMATIC, this field is ignored
  1204.  
  1205.     short dataAxisYAutoScale;       //PEBOOL, PE_UNCHANGED for no change
  1206.     short dataAxisY2AutoScale;      //PEBOOL, PE_UNCHANGED for no change
  1207.     short seriesAxisAutoScale;      //PEBOOL, PE_UNCHANGED for no change
  1208.  
  1209. }  PEGraphAxisInfo;
  1210.  
  1211. #define PE_SIZEOF_GRAPH_AXIS_INFO (sizeof (PEGraphAxisInfo))
  1212.  
  1213. PEBOOL CRPE_API PEGetGraphAxisInfo(short printJob, 
  1214.                                  short sectionN, 
  1215.                                  short graphN, 
  1216.                                  PEGraphAxisInfo FAR * graphAxisInfo);
  1217.  
  1218. PEBOOL CRPE_API PESetGraphAxisInfo(short printJob, 
  1219.                                  short sectionN, 
  1220.                                  short graphN, 
  1221.                                  PEGraphAxisInfo FAR * graphAxisInfo);
  1222.  
  1223. /*******************************************/
  1224. // formula operations
  1225. /********************************************/
  1226. short CRPE_API PEGetNFormulas (short printJob);
  1227.  
  1228. PEBOOL CRPE_API PEGetNthFormula (short printJob,
  1229.                                short formulaN,
  1230.                                PEHANDLE FAR *nameHandle,
  1231.                                short FAR *nameLength,
  1232.                                PEHANDLE FAR *textHandle,
  1233.                                short FAR *textLength);
  1234.  
  1235. PEBOOL CRPE_API PEGetFormula (short printJob,
  1236.                             const char FAR *formulaName,
  1237.                             PEHANDLE FAR *textHandle,
  1238.                             short FAR *textLength);
  1239.  
  1240. PEBOOL CRPE_API PESetFormula (short printJob,
  1241.                             const char FAR *formulaName,
  1242.                             const char FAR *formulaString);
  1243.  
  1244. // Format formula name
  1245. // Old naming convention
  1246. #define SECTION_VISIBILITY               58
  1247. #define NEW_PAGE_BEFORE                  60
  1248. #define NEW_PAGE_AFTER                   61
  1249. #define KEEP_SECTION_TOGETHER            62
  1250. #define SUPPRESS_BLANK_SECTION           63
  1251. #define RESET_PAGE_N_AFTER               64
  1252. #define PRINT_AT_BOTTOM_OF_PAGE          65
  1253. #define UNDERLAY_SECTION                 66
  1254. #define SECTION_BACK_COLOUR              67
  1255.  
  1256. // New naming convention
  1257. #define PE_FFN_AREASECTION_VISIBILITY           58  // area & section format
  1258. #define PE_FFN_SECTION_VISIBILITY               58  // section format
  1259. #define PE_FFN_SHOW_AREA                        59  // area format
  1260. #define PE_FFN_NEW_PAGE_BEFORE                  60  // area & section format
  1261. #define PE_FFN_NEW_PAGE_AFTER                   61  // area & section format
  1262. #define PE_FFN_KEEP_TOGETHER                    62  // area & section format
  1263. #define PE_FFN_SUPPRESS_BLANK_SECTION           63  // section format
  1264. #define PE_FFN_RESET_PAGE_N_AFTER               64  // area & section format
  1265. #define PE_FFN_PRINT_AT_BOTTOM_OF_PAGE          65  // area & section format
  1266. #define PE_FFN_UNDERLAY_SECTION                 66  // section format
  1267. #define PE_FFN_SECTION_BACK_COLOUR              67  // section format
  1268. #define PE_FFN_SECTION_BACK_COLOR               67  // section format
  1269.  
  1270. PEBOOL CRPE_API PEGetAreaFormatFormula (short printJob,
  1271.                                       short areaCode,
  1272.                                       short formulaName, // an area PE_FFN_ constant
  1273.                                       PEHANDLE FAR *textHandle,
  1274.                                       short FAR *textLength);
  1275.  
  1276. PEBOOL CRPE_API PESetAreaFormatFormula (short printJob,
  1277.                                       short areaCode,
  1278.                                       short formulaName, // an area PE_FFN_ constant
  1279.                                       const char FAR *formulaString);
  1280.  
  1281. PEBOOL CRPE_API PEGetSectionFormatFormula (short printJob,
  1282.                                          short sectionCode,
  1283.                                          short formulaName, // a section PE_FFN_ constant
  1284.                                          PEHANDLE FAR *textHandle,
  1285.                                          short FAR *textLength);
  1286.  
  1287. PEBOOL CRPE_API PESetSectionFormatFormula (short printJob,
  1288.                                          short sectionCode,
  1289.                                          short formulaName, // a section PE_FFN_ constant
  1290.                                          const char FAR *formulaString);
  1291.  
  1292. PEBOOL CRPE_API PECheckFormula (short printJob,
  1293.                               const char FAR *formulaName);
  1294.  
  1295. PEBOOL CRPE_API PEGetSelectionFormula (short printJob,
  1296.                                      PEHANDLE FAR *textHandle,
  1297.                                      short FAR *textLength);
  1298.  
  1299. PEBOOL CRPE_API PESetSelectionFormula (short printJob,
  1300.                                      const char FAR *formulaString);
  1301.  
  1302. PEBOOL CRPE_API PECheckSelectionFormula (short printJob);
  1303.  
  1304. PEBOOL CRPE_API PEGetGroupSelectionFormula (short printJob,
  1305.                                           PEHANDLE FAR *textHandle,
  1306.                                           short FAR *textLength);
  1307.  
  1308. PEBOOL CRPE_API PESetGroupSelectionFormula (short printJob,
  1309.                                           const char FAR *formulaString);
  1310.  
  1311. PEBOOL CRPE_API PECheckGroupSelectionFormula (short printJob);
  1312.  
  1313. /* ************************************ */
  1314. /*          SQL Expressions             */
  1315. /* ************************************ */
  1316. short CRPE_API PEGetNSQLExpressions (short printJob);
  1317.  
  1318. PEBOOL CRPE_API PEGetNthSQLExpression (short printJob,
  1319.                                     short expressionN,
  1320.                                     PEHANDLE FAR *nameHandle,
  1321.                                     short FAR *nameLength,
  1322.                                     PEHANDLE FAR *textHandle,
  1323.                                     short FAR *textLength);
  1324.  
  1325. PEBOOL CRPE_API PEGetSQLExpression (short printJob,
  1326.                                     const char FAR *expressionName,
  1327.                                     PEHANDLE FAR *textHandle,
  1328.                                     short FAR *textLength);
  1329.  
  1330. PEBOOL CRPE_API PESetSQLExpression (short printJob,
  1331.                                     const char FAR *expressionName,
  1332.                                     const char FAR *expressionString);
  1333.  
  1334. PEBOOL CRPE_API PECheckSQLExpression (short printJob,
  1335.                                     const char FAR *expressionName);
  1336.  
  1337. /********************************************************************************/
  1338. // NOTE : Stored Procedures
  1339. //
  1340. // The previous Stored Procedure API Calls PEGetNParams, PEGetNthParam,
  1341. // PEGetNthParamInfo and PESetNthParam have been made obsolete.  Older 
  1342. // applications that used these API Calls will still work as before, but for new 
  1343. // development please use the new Parameter API calls below, 
  1344. //
  1345. // The Stored Procedure Parameters have now been unified with the Parameter 
  1346. // Fields.
  1347. //
  1348. // The replacements for these calls are as follows : 
  1349. //        PEGetNParams        = PEGetNParameterFields
  1350. //        PEGetNthParam        = PEGetNthParameterField
  1351. //        PEGetNthParamInfo    = PEGetParameterValueInfo
  1352. //        PESetNthParam        = PESetNthParameterField
  1353. //
  1354. // NOTE : To tell if a Parameter Field is a Stored Procedure, use the 
  1355. //          PEGetNthParameterType or PEGetNthParameterField API Calls
  1356. //
  1357. // If you wish to SET a parameter to NULL then set the CurrentValue to CRWNULL.
  1358. // The CRWNULL is of Type String and is independant of the datatype of the 
  1359. // parameter.
  1360. //
  1361. /********************************************************************************/
  1362.  
  1363. /****************************************/
  1364. // Parameter field operation
  1365. /****************************************/
  1366. #define PE_WORD_LEN           2
  1367. #define PE_PF_REPORT_NAME_LEN 128
  1368. #define PE_PF_NAME_LEN        256
  1369. #define PE_PF_PROMPT_LEN      256
  1370. #define PE_PF_VALUE_LEN       256
  1371. #define PE_PF_EDITMASK_LEN    256
  1372.  
  1373. #define PE_PF_NUMBER          0
  1374. #define PE_PF_CURRENCY        1
  1375. #define PE_PF_BOOLEAN         2
  1376. #define PE_PF_DATE            3
  1377. #define PE_PF_STRING          4
  1378. #define PE_PF_DATETIME        5
  1379. #define PE_PF_TIME            6
  1380.  
  1381. typedef struct PEParameterFieldInfo
  1382. {
  1383. #if defined (__cplusplus)
  1384.     PEParameterFieldInfo ()
  1385.     {
  1386.         StructSize = sizeof (PEParameterFieldInfo);
  1387.         ValueType = PE_UNCHANGED;
  1388.         DefaultValueSet = 0;    // PEWORD is unsigned, so set it to 0 instead of PE_UNCHANGED
  1389.         CurrentValueSet = 0;    // PEWORD is unsigned, so set it to 0 instead of PE_UNCHANGED
  1390.         Name [0] = '\0';
  1391.         Prompt [0] = '\0';
  1392.         DefaultValue [0] = '\0';
  1393.         CurrentValue [0] = '\0';
  1394.         ReportName [0] = '\0';
  1395.         needsCurrentValue = 0;  // PEWORD is unsigned, so set it to 0 instead of PE_UNCHANGED
  1396.         isLimited = 0;          // PEWORD is unsigned, so set it to 0 instead of PE_UNCHANGED
  1397.         MinSize = 0.0;
  1398.         MaxSize = 0.0;
  1399.         EditMask [0] = '\0';
  1400.         isHidden = PE_UNCHANGED; // obsolete
  1401.         isLinked = '\0';
  1402.     };
  1403. #endif
  1404.  
  1405.     // Initialize to PE_SIZEOF_PARAMETER_FIELD_INFO.
  1406.     PEWORD StructSize;
  1407.  
  1408.     // PE_PF_ constant
  1409.     PEWORD ValueType;
  1410.  
  1411.     // Indicate the default value is set in PEParameterFieldInfo.
  1412.     PEWORD DefaultValueSet;
  1413.  
  1414.     // Indicate the current value is set in PEParameterFieldInfo.
  1415.     PEWORD CurrentValueSet;
  1416.  
  1417.     // All strings are null-terminated.
  1418.     char Name [PE_PF_NAME_LEN];
  1419.     char Prompt [PE_PF_PROMPT_LEN];
  1420.  
  1421.     // Could be Number, Currency, Boolean, Date, DateTime, Time, or String
  1422.     char DefaultValue [PE_PF_VALUE_LEN];
  1423.     char CurrentValue [PE_PF_VALUE_LEN];
  1424.  
  1425.     // name of report where the field belongs, only used in
  1426.     // PEGetNthParameterField and PENewParameterField
  1427.     char ReportName [PE_PF_REPORT_NAME_LEN];
  1428.  
  1429.     // returns false if parameter is linked, not in use, or has current value set
  1430.     PEWORD needsCurrentValue;
  1431.  
  1432.     //for String values this will be PETRUE if the string is limited on length, for 
  1433.     //other types it will be PETRUE if the parameter is limited by a range
  1434.     PEWORD isLimited;
  1435.  
  1436.     //For string fields, these are the minimum/maximum length of the string.
  1437.     //For numeric fields, they are the minimum/maximum numeric value.
  1438.     //For other fields, use PEGetParameterMinMaxValue
  1439.     double MinSize;
  1440.     double MaxSize;
  1441.  
  1442.     //An edit mask that restricts what may be entered for string parameters.
  1443.     char EditMask [PE_PF_EDITMASK_LEN];
  1444.  
  1445.     PEWORD isHidden; // obsolete
  1446.  
  1447.     // Indicate if this parameter is linked to a subreport. Readonly. Set will ignore it.
  1448.     PEWORD isLinked;
  1449. }PEParameterFieldInfo;
  1450.  
  1451. #define PE_SIZEOF_PARAMETER_FIELD_INFO (sizeof (PEParameterFieldInfo))
  1452.  
  1453. short CRPE_API PEGetNParameterFields (short printJob);
  1454.  
  1455. PEBOOL CRPE_API PEGetNthParameterField (short printJob,
  1456.                                       short parameterN,
  1457.                                       PEParameterFieldInfo FAR *parameterInfo);
  1458.  
  1459. PEBOOL CRPE_API PESetNthParameterField (short printJob,
  1460.                                       short parameterN,
  1461.                                       PEParameterFieldInfo FAR *parameterInfo);
  1462.  
  1463. // define value type
  1464. #define PE_VI_NUMBER       0
  1465. #define PE_VI_CURRENCY     1
  1466. #define PE_VI_BOOLEAN      2
  1467. #define PE_VI_DATE         3
  1468. #define PE_VI_STRING       4
  1469. #define PE_VI_DATETIME     5
  1470. #define PE_VI_TIME         6
  1471. #define PE_VI_INTEGER      7
  1472. #define PE_VI_COLOR        8
  1473. #define PE_VI_CHAR         9
  1474. #define PE_VI_LONG         10
  1475. #define PE_VI_STRINGHANDLE 11 // use viLong as handle and then call PEGetHandleString
  1476. #define PE_VI_HANDLE       12 // use viLong as generic handle.
  1477. #define PE_VI_NOVALUE      100
  1478.  
  1479. #define PE_VI_STRING_LEN 256
  1480.  
  1481. typedef struct PEValueInfo
  1482. {
  1483. #if defined (__cplusplus)
  1484.     PEValueInfo ()
  1485.     {
  1486.         StructSize = sizeof (PEValueInfo);
  1487.         valueType = PE_VI_NOVALUE; // a PE_VI_ constant
  1488.         viNumber = 0.0;
  1489.         viCurrency = 0.0;
  1490.         viBoolean = PE_UNCHANGED;
  1491.         viString[0] = 0;
  1492.         for (int i=0; i<3; i++)
  1493.         {
  1494.             viDate[i] = PE_UNCHANGED;
  1495.             viDateTime[i] = PE_UNCHANGED;
  1496.             viDateTime[i+3] = PE_UNCHANGED;
  1497.             viTime[i] = PE_UNCHANGED;
  1498.         }
  1499.         viColor = PE_UNCHANGED_COLOR;
  1500.         viInteger = 0;
  1501.         viC = '\0';
  1502.         viLong = PE_UNCHANGED;
  1503.     };
  1504. #endif
  1505.  
  1506.     PEWORD StructSize;
  1507.     PEWORD valueType; // a PE_VI_ constant
  1508.     double viNumber;
  1509.     double viCurrency;
  1510.     PEBOOL viBoolean;
  1511.     char viString[PE_VI_STRING_LEN];
  1512.     short viDate[3]; // year, month, day
  1513.     short viDateTime[6]; // year, month, day, hour, minute, second
  1514.     short viTime[3];  // hour, minute, second
  1515.     PECOLORREF viColor;
  1516.     short viInteger;
  1517.     char viC; //PEBYTE
  1518.     char ignored; // for 4 byte alignment. ignored.
  1519.     long viLong;
  1520. } PEValueInfo;
  1521.  
  1522. #define PE_SIZEOF_VALUE_INFO (sizeof (PEValueInfo))
  1523.  
  1524. // Converting parameterInfo default value or current value into value info
  1525. // pass default vaule or current value in PEParameterFieldInfo into these two functions.
  1526. PEBOOL CRPE_API PEConvertPFInfoToVInfo(void FAR * value, short valueType, PEValueInfo FAR * valueInfo);
  1527. PEBOOL CRPE_API PEConvertVInfoToPFInfo(PEValueInfo FAR * valueInfo, PEWORD FAR * valueType, void FAR * value);
  1528.  
  1529. // Default values for Parameter fields.
  1530. // ////////////////////////////////////
  1531.  
  1532. // If return value is -1 then an error has occurred.
  1533. short CRPE_API PEGetNParameterDefaultValues (short printJob,
  1534.                                              const char FAR * parameterFieldName,
  1535.                                              const char FAR * reportName);
  1536.  
  1537. PEBOOL  CRPE_API PEGetNthParameterDefaultValue (short printJob,
  1538.                                                 const char FAR * parameterFieldName,
  1539.                                                 const char FAR * reportName, short index,
  1540.                                                 PEValueInfo FAR * valueInfo);
  1541.  
  1542. PEBOOL  CRPE_API PESetNthParameterDefaultValue (short printJob,
  1543.                                                 const char FAR * parameterFieldName,
  1544.                                                 const char FAR * reportName,
  1545.                                                 short index,
  1546.                                                 PEValueInfo FAR * valueInfo);
  1547.  
  1548. PEBOOL  CRPE_API PEAddParameterDefaultValue (short printJob,
  1549.                                              const char FAR * parameterFieldName,
  1550.                                              const char FAR * reportName,
  1551.                                              PEValueInfo FAR * valueInfo);
  1552.  
  1553. PEBOOL  CRPE_API PEDeleteNthParameterDefaultValue (short printJob,
  1554.                                                    const char FAR * parameterFieldName,
  1555.                                                    const char FAR * reportName,
  1556.                                                    short index);
  1557.  
  1558. // Min/Max values for Parameter fields.
  1559. // ////////////////////////////////////
  1560. PEBOOL  CRPE_API PEGetParameterMinMaxValue (short printJob, const char FAR * parameterFieldName,
  1561.                                           const char FAR * reportName,
  1562.                                           PEValueInfo FAR * valueMin, // Set to PENULL to retrieve MAX only; must be non-PENULL if valueMax is PENULL.
  1563.                                           PEValueInfo FAR * valueMax  // Set to PENULL to retrieve MIN only; must be non-PENULL if valueMin is PENULL.
  1564.                                           );
  1565. PEBOOL  CRPE_API PESetParameterMinMaxValue (short printJob, const char FAR * parameterFieldName,
  1566.                                           const char FAR * reportName,
  1567.                                           PEValueInfo FAR * valueMin, // Set to PENULL to set MAX only; must be non-PENULL if valueMax is PENULL.
  1568.                                           PEValueInfo FAR * valueMax  // Set to PENULL to set MIN only; must be non-PENULL if valueMin is PENULL.
  1569.                                                                         // If both valueInfo and valueMax are non-PENULL then
  1570.                                                                         // valueMin->valueType MUST BE THE SAME AS valueMax->valueType.
  1571.                                                                         // If different, PE_ERR_INCONSISTANTTYPES is returned.
  1572.                                           );
  1573.  
  1574. // Pick list options in Parameter fields.
  1575. // //////////////////////////////////////
  1576. PEBOOL CRPE_API PEGetNthParameterValueDescription (short printJob, const char FAR * parameterFieldName,
  1577.                                                  const char FAR * reportName, short index, PEHANDLE FAR * valueDesc,
  1578.                                                  short FAR *valueDescLength);
  1579. PEBOOL CRPE_API PESetNthParameterValueDescription (short printJob, const char FAR * parameterFieldName,
  1580.                                                  const char FAR * reportName, short index, char FAR * valueDesc);
  1581.  
  1582. // constants for sortMethod in PEParameterPickListOption struct
  1583. #define PE_OR_NO_SORT                   0
  1584. #define PE_OR_ALPHANUMERIC_ASCENDING    1
  1585. #define PE_OR_ALPHANUMERIC_DESCENDING   2
  1586. #define PE_OR_NUMERIC_ASCENDING         3
  1587. #define PE_OR_NUMERIC_DESCENDING        4
  1588.  
  1589. typedef struct PEParameterPickListOption
  1590. {
  1591. #if defined (__cplusplus)
  1592.     PEParameterPickListOption ()
  1593.     {
  1594.         StructSize = sizeof (PEParameterPickListOption);
  1595.         showDescOnly = PE_UNCHANGED;
  1596.         sortMethod = PE_UNCHANGED;
  1597.         sortBasedOnDesc = PE_UNCHANGED;
  1598.     };
  1599. #endif
  1600.  
  1601.     PEWORD  StructSize;       // initialize to PE_SIZEOF_PICK_LIST_OPTION
  1602.     short showDescOnly;     // boolean value or PE_UNCHANGED
  1603.     short sortMethod;       // enum type const, PE_UNCHANGED for no change
  1604.     short sortBasedOnDesc;  // boolean value or PE_UNCHANGED
  1605. } PEParameterPickListOption;
  1606. #define PE_SIZEOF_PICK_LIST_OPTION (sizeof (PEParameterPickListOption))
  1607.  
  1608. PEBOOL CRPE_API PEGetParameterPickListOption (short printJob, const char FAR * parameterFieldName,
  1609.                                             const char FAR * reportName, PEParameterPickListOption FAR * pickListOption);
  1610. PEBOOL CRPE_API PESetParameterPickListOption (short printJob, const char FAR * parameterFieldName,
  1611.                                             const char FAR * reportName, PEParameterPickListOption FAR * pickListOption);
  1612. // Parameter current values
  1613. ///////////////////////////
  1614. // parameter field origin
  1615. #define PE_PO_REPORT         0
  1616. #define PE_PO_STOREDPROC     1
  1617. #define PE_PO_QUERY          2
  1618.  
  1619. // range info
  1620. #define PE_RI_INCLUDEUPPERBOUND 1
  1621. #define PE_RI_INCLUDELOWERBOUND 2
  1622. #define PE_RI_NOUPPERBOUND      4
  1623. #define PE_RI_NOLOWERBOUND      8
  1624.  
  1625. #define PE_DR_HASRANGE              0
  1626. #define PE_DR_HASDISCRETE           1
  1627. #define PE_DR_HASDISCRETEANDRANGE   2
  1628.  
  1629. typedef struct PEParameterValueInfo
  1630. {
  1631. #if defined (__cplusplus)
  1632.     PEParameterValueInfo ()
  1633.     {
  1634.         StructSize = sizeof (PEParameterValueInfo);
  1635.         isNullable = PE_UNCHANGED;
  1636.         disallowEditing = PE_UNCHANGED;
  1637.         allowMultipleValues = PE_UNCHANGED;
  1638.         hasDiscreteValues = PE_UNCHANGED;
  1639.         partOfGroup = PE_UNCHANGED;
  1640.         groupNum = PE_UNCHANGED;
  1641.         mutuallyExclusiveGroup = PE_UNCHANGED;
  1642.     };
  1643. #endif
  1644.  
  1645.     PEWORD StructSize;
  1646.     short isNullable;               // Boolean value or PE_UNCHANGED for no change.
  1647.     short disallowEditing;          // Boolean value or PE_UNCHANGED for no change.
  1648.     short allowMultipleValues;      // Boolean value or PE_UNCHANGED for no change.
  1649.     short hasDiscreteValues;        // int value or PE_UNCHANGED for no change.
  1650.                                     // 0 means has ranges, 1 means has discrete values
  1651.                                     // 2 means has discrete and ranged values
  1652.     short partOfGroup;              // Boolean value or PE_UNCHANGED for no change.
  1653.     short groupNum;                 // a group number or PE_UNCHANGED for no change.
  1654.     short mutuallyExclusiveGroup;   // Boolean value or PE_UNCHANGED for no change.
  1655. } PEParameterValueInfo;
  1656. #define PE_SIZEOF_PARAMETER_VALUE_INFO (sizeof (PEParameterValueInfo))
  1657.  
  1658. PEBOOL CRPE_API PEGetParameterValueInfo (short printJob,
  1659.                                          const char FAR * parameterFieldName,
  1660.                                          const char FAR * reportName,
  1661.                                          PEParameterValueInfo FAR * valueInfo);
  1662.  
  1663. PEBOOL CRPE_API PESetParameterValueInfo (short printJob,
  1664.                                          const char FAR * parameterFieldName,
  1665.                                          const char FAR * reportName,
  1666.                                          PEParameterValueInfo FAR * valueInfo);
  1667.  
  1668. // If return value is -1 then an error has occurred.
  1669. short CRPE_API PEGetNParameterCurrentValues (short printJob,
  1670.                                                       const char FAR * parameterFieldName,
  1671.                                                       const char FAR * reportName);
  1672.  
  1673. PEBOOL CRPE_API PEGetNthParameterCurrentValue (short printJob,
  1674.                                                const char FAR * parameterFieldName,
  1675.                                                const char FAR * reportName,
  1676.                                                short index,
  1677.                                                PEValueInfo FAR * currentValue);
  1678.  
  1679. PEBOOL CRPE_API PEAddParameterCurrentValue (short printJob,
  1680.                                             const char FAR * parameterFieldName,
  1681.                                             const char FAR * reportName,
  1682.                                             PEValueInfo FAR * currentValue);
  1683.  
  1684. // If return value is -1 then an error has occurred.
  1685. short CRPE_API PEGetNParameterCurrentRanges (short printJob,
  1686.                                                       const char FAR * parameterFieldName,
  1687.                                                       const char FAR * reportName);
  1688.  
  1689. PEBOOL CRPE_API PEGetNthParameterCurrentRange (short printJob,
  1690.                                                const char FAR * parameterFieldName, // if parameterFieldName does not contain ranges then
  1691.                                                const char FAR * reportName,
  1692.                                                short index,                         // last error is set to PE_ERR_RANGEORDISCRETE.
  1693.                                                PEValueInfo FAR * rangeStart,
  1694.                                                PEValueInfo FAR * rangeEnd,
  1695.                                                short FAR *rangeInfo    // one or more PE_RI_* constants.
  1696.                                               );
  1697.  
  1698. PEBOOL CRPE_API PEAddParameterCurrentRange (short printJob,
  1699.                                             const char FAR * parameterFieldName,  // if parameterFieldName does not contain ranges then
  1700.                                             const char FAR * reportName,                                    // last error is set to PE_ERR_RANGEORDISCRETE.
  1701.                                             PEValueInfo FAR * rangeStart, PEValueInfo FAR * rangeEnd,
  1702.                                             short rangeInfo     // one or more PE_RI_* constants.
  1703.                                            );
  1704.  
  1705. short CRPE_API PEGetNthParameterType (short printJob, short index); // returns PE_PO_* or -1 if index is invalid.
  1706. PEBOOL  CRPE_API PEClearParameterCurrentValuesAndRanges (short printJob,
  1707.                                                          const char FAR * parameterFieldName,
  1708.                                                          const char FAR * reportName);
  1709.  
  1710. /**********************************************/
  1711. // Adding, controlling sort order and group sort order
  1712. /**********************************************/
  1713. short CRPE_API PEGetNSortFields (short printJob);
  1714.  
  1715. PEBOOL CRPE_API PEGetNthSortField (short printJob,
  1716.                                  short sortFieldN,
  1717.                                  PEHANDLE FAR *nameHandle,
  1718.                                  short  FAR *nameLength,
  1719.                                  short  FAR *direction);
  1720.  
  1721. PEBOOL CRPE_API PESetNthSortField (short printJob,
  1722.                                  short sortFieldN,
  1723.                                  const char FAR *name, // formula form
  1724.                                  short direction);  // a PE_SF_ constant
  1725.  
  1726. PEBOOL CRPE_API PEDeleteNthSortField (short printJob,
  1727.                                     short sortFieldN);
  1728.  
  1729. short CRPE_API PEGetNGroupSortFields (short printJob);
  1730.  
  1731. PEBOOL CRPE_API PEGetNthGroupSortField (short printJob,
  1732.                                       short sortFieldN,
  1733.                                       PEHANDLE FAR *nameHandle,
  1734.                                       short  FAR *nameLength,
  1735.                                       short  FAR *direction); // a PE_SF_ constant
  1736.  
  1737. PEBOOL CRPE_API PESetNthGroupSortField (short printJob,
  1738.                                       short sortFieldN,
  1739.                                       const char FAR *name,
  1740.                                       short direction);
  1741.  
  1742. PEBOOL CRPE_API PEDeleteNthGroupSortField (short printJob,
  1743.                                          short sortFieldN);
  1744.  
  1745. /********************************************/
  1746. // Controlling databases
  1747. /********************************************/
  1748.  
  1749. // The following functions allow retrieving and updating database info
  1750. // in an opened report, so that a report can be printed using different
  1751. // session, server, database, user and/or table location settings.  Any
  1752. // changes made to the report via these functions are not permanent, and
  1753. // only last as long as the report is open.
  1754. //
  1755. // The following database functions (except for PELogOnServer and
  1756. // PELogOffServer) must be called after PEOpenPrintJob and before
  1757. // PEStartPrintJob.
  1758.  
  1759. // The function PEGetNTables is called to fetch the number of tables in
  1760. // the report.  This includes all PC databases (e.g. Paradox, xBase)
  1761. // as well as SQL databases (e.g. SQL Server, Oracle, Netware).
  1762.  
  1763. short CRPE_API PEGetNTables (short printJob);
  1764.  
  1765.  
  1766. // The function PEGetNthTableType allows the application to determine the
  1767. // type of each table.  The application can test DBType (equal to
  1768. // PE_DT_STANDARD or PE_DT_SQL), or test the database DLL name used to
  1769. // create the report.  DLL names have the following naming convention:
  1770. //     - PDB*.DLL for standard (non-SQL) databases,
  1771. //     - PDS*.DLL for SQL databases.
  1772. //
  1773. // In the case of ODBC (PDSODBC.DLL) the DescriptiveName includes the
  1774. // ODBC data source name.
  1775.  
  1776. #define PE_WORD_LEN          2
  1777. #define PE_DLL_NAME_LEN      64
  1778. #define PE_FULL_NAME_LEN     256
  1779.  
  1780. #define PE_DT_STANDARD               1
  1781. #define PE_DT_SQL                    2
  1782. #define PE_DT_SQL_STORED_PROCEDURE   3
  1783.  
  1784. typedef struct PETableType
  1785. {
  1786. #if defined (__cplusplus)
  1787.     PETableType ()
  1788.     {
  1789.         StructSize = sizeof (PETableType);
  1790.         DLLName [0] = '\0';
  1791.         DescriptiveName [0] = '\0';
  1792.         DBType = PE_UNCHANGED;
  1793.     };
  1794. #endif
  1795.  
  1796.     // Initialize to PE_SIZEOF_TABLE_TYPE.
  1797.     PEWORD StructSize;
  1798.  
  1799.     // All strings are null-terminated.
  1800.     char DLLName [PE_DLL_NAME_LEN];
  1801.     char DescriptiveName [PE_FULL_NAME_LEN];
  1802.  
  1803.     PEWORD DBType;
  1804.  
  1805. }PETableType;
  1806. #define PE_SIZEOF_TABLE_TYPE (sizeof (PETableType))
  1807.  
  1808. PEBOOL  CRPE_API PEGetNthTableType (short printJob,
  1809.                                   short tableN,
  1810.                                   PETableType FAR *tableType);
  1811.  
  1812. // The functions PEGetNthTableSessionInfo and PESetNthTableSessionInfo
  1813. // are only used when connecting to MS Access databases (which require a
  1814. // session to be opened first)
  1815.  
  1816. #define PE_LONGPTR_LEN       4
  1817. #define PE_SESS_USERID_LEN   128
  1818. #define PE_SESS_PASSWORD_LEN 128
  1819.  
  1820. typedef struct PESessionInfo
  1821. {
  1822. #if defined (__cplusplus)
  1823.     PESessionInfo ()
  1824.     {
  1825.         StructSize = sizeof (PESessionInfo);
  1826.         UserID [0] = '\0';
  1827.         Password [0] = '\0';
  1828.         SessionHandle = 0;
  1829.     };
  1830. #endif
  1831.  
  1832.     // Initialize to PE_SIZEOF_SESSION_INFO.
  1833.     PEWORD StructSize;
  1834.  
  1835.     // All strings are null-terminated.
  1836.     char UserID [PE_SESS_PASSWORD_LEN];
  1837.  
  1838.     // Password is undefined when getting information from report.
  1839.     char Password [PE_SESS_PASSWORD_LEN];
  1840.  
  1841.     // SessionHandle is undefined when getting information from report.
  1842.     // When setting information, if it is = 0 the UserID and Password
  1843.     // settings are used, otherwise the SessionHandle is used.
  1844.     PEDWORD SessionHandle;
  1845. }
  1846.     PESessionInfo;
  1847. #define PE_SIZEOF_SESSION_INFO (sizeof (PESessionInfo))
  1848.  
  1849.  
  1850. PEBOOL  CRPE_API PEGetNthTableSessionInfo (short printJob,
  1851.                                          short tableN,
  1852.                                          PESessionInfo FAR *sessionInfo);
  1853. PEBOOL  CRPE_API PESetNthTableSessionInfo (short printJob,
  1854.                                          short tableN,
  1855.                                          PESessionInfo FAR *sessionInfo,
  1856.                                          PEBOOL propagateAcrossTables);
  1857.  
  1858.  
  1859. // Logging on is performed when printing the report, but the correct
  1860. // log on information must first be set using PESetNthTableLogOnInfo.
  1861. // Only the password is required, but the server, database, and
  1862. // user names may optionally be overriden as well.
  1863. //
  1864. // If the parameter propagateAcrossTables is PETRUE, the new log on info
  1865. // is also applied to any other tables in this report that had the
  1866. // same original server and database names as this table.  If PEFALSE
  1867. // only this table is updated.
  1868. //
  1869. // Logging off is performed automatically when the print job is closed
  1870.  
  1871. #define PE_SERVERNAME_LEN    128
  1872. #define PE_DATABASENAME_LEN  128
  1873. #define PE_USERID_LEN        128
  1874. #define PE_PASSWORD_LEN      128
  1875.  
  1876. typedef struct PELogOnInfo
  1877. {
  1878. #if defined (__cplusplus)
  1879.     PELogOnInfo ()
  1880.     {
  1881.         StructSize = sizeof (PELogOnInfo);
  1882.         ServerName [0] = '\0';
  1883.         DatabaseName [0] = '\0';
  1884.         UserID [0] = '\0';
  1885.         Password [0] = '\0';
  1886.     };
  1887. #endif
  1888.  
  1889.     // Initialize to PE_SIZEOF_LOGON_INFO.
  1890.     PEWORD StructSize;
  1891.  
  1892.     // For any of the following values an empty string ("") means to use
  1893.     // the value already set in the report.  To override a value in the
  1894.     // report use a non-empty string (e.g. "Server A").  All strings are
  1895.     // null-terminated.
  1896.     //
  1897.     // For Netware SQL, pass the dictionary path name in ServerName and
  1898.     // data path name in DatabaseName.
  1899.     char ServerName [PE_SERVERNAME_LEN];
  1900.     char DatabaseName [PE_DATABASENAME_LEN];
  1901.     char UserID [PE_USERID_LEN];
  1902.  
  1903.     // Password is undefined when getting information from report.
  1904.     char Password [PE_PASSWORD_LEN];
  1905. }PELogOnInfo;
  1906. #define PE_SIZEOF_LOGON_INFO (sizeof (PELogOnInfo))
  1907.  
  1908. PEBOOL  CRPE_API PEGetNthTableLogOnInfo (short printJob,
  1909.                                        short tableN,
  1910.                                        PELogOnInfo FAR *logOnInfo);
  1911.  
  1912. PEBOOL  CRPE_API PESetNthTableLogOnInfo (short printJob,
  1913.                                        short tableN,
  1914.                                        PELogOnInfo FAR *logOnInfo,
  1915.                                        PEBOOL propagateAcrossTables);
  1916.  
  1917. // A table's location is fetched and set using PEGetNthTableLocation and
  1918. // PESetNthTableLocation.  This name is database-dependent, and must be
  1919. // formatted correctly for the expected database.  For example:
  1920. //     - Paradox: "c:\crw\ORDERS.DB"
  1921. //     - SQL Server: "publications.dbo.authors"
  1922.  
  1923. #define PE_TABLE_LOCATION_LEN      256
  1924. #define PE_CONNECTION_BUFFER_LEN   512
  1925.  
  1926. typedef struct PETableLocation
  1927. {
  1928. #if defined (__cplusplus)
  1929.     PETableLocation ()
  1930.     {
  1931.         StructSize = sizeof (PETableLocation);
  1932.         Location [0] = '\0';
  1933.         SubLocation[0] = '\0';
  1934.         ConnectBuffer[0] = '\0';
  1935.     };
  1936. #endif
  1937.  
  1938.     // Initialize to PE_SIZEOF_TABLE_LOCATION.
  1939.     PEWORD StructSize;
  1940.  
  1941.     // String is null-terminated.
  1942.     char Location [PE_TABLE_LOCATION_LEN];
  1943.     char SubLocation[PE_TABLE_LOCATION_LEN];
  1944.     char ConnectBuffer[PE_CONNECTION_BUFFER_LEN];    //Connection Info for attached tables
  1945. }PETableLocation;
  1946. #define PE_SIZEOF_TABLE_LOCATION (sizeof (PETableLocation))
  1947.  
  1948. PEBOOL  CRPE_API PEGetNthTableLocation (short printJob,
  1949.                                       short tableN,
  1950.                                       PETableLocation FAR *location);
  1951.  
  1952. PEBOOL  CRPE_API PESetNthTableLocation (short printJob,
  1953.                                       short tableN,
  1954.                                       PETableLocation FAR *location);
  1955.  
  1956. // Table Private Info
  1957.  
  1958. typedef struct PETablePrivateInfo
  1959. {
  1960. #if defined (__cplusplus)
  1961.     PETablePrivateInfo ()
  1962.     {
  1963.         StructSize = sizeof (PETablePrivateInfo);
  1964.         nBytes = 0;
  1965.         tag = 0;
  1966.         dataPtr = 0;
  1967.     };
  1968. #endif
  1969.  
  1970.     PEWORD StructSize;  // initialize to PE_SIZEOF_TABLE_PRIVATE_INFO
  1971.     PEWORD nBytes;
  1972.     PEDWORD tag;
  1973.     PEBYTE FAR * dataPtr;
  1974. } PETablePrivateInfo;
  1975. #define PE_SIZEOF_TABLE_PRIVATE_INFO (sizeof(PETablePrivateInfo))
  1976.  
  1977. PEBOOL CRPE_API PEGetNthTablePrivateInfo (short printJob,
  1978.                                         short tableN,
  1979.                                         PETablePrivateInfo FAR *privateInfo);
  1980.  
  1981. PEBOOL CRPE_API PESetNthTablePrivateInfo (short printJob,
  1982.                                         short tableN,
  1983.                                         PETablePrivateInfo FAR *privateInfo);
  1984.  
  1985. // The function PETestNthTableConnectivity tests whether a database
  1986. // table's settings are valid and ready to be reported on.  It returns
  1987. // true if the database session, log on, and location info is all
  1988. // correct.
  1989. //
  1990. // This is useful, for example, in prompting the user and testing a
  1991. // server password before printing begins.
  1992. //
  1993. // This function may require a significant amount of time to complete,
  1994. // since it will first open a user session (if required), then log onto
  1995. // the database server (if required), and then open the appropriate
  1996. // database table (to test that it exists).  It does not read any data,
  1997. // and closes the table immediately once successful.  Logging off is
  1998. // performed when the print job is closed.
  1999. //
  2000. // If it fails in any of these steps, the error code set indicates
  2001. // which database info needs to be updated using functions above:
  2002. //    - If it is unable to begin a session, PE_ERR_DATABASESESSION is set,
  2003. //      and the application should update with PESetNthTableSessionInfo.
  2004. //    - If it is unable to log onto a server, PE_ERR_DATABASELOGON is set,
  2005. //      and the application should update with PESetNthTableLogOnInfo.
  2006. //    - If it is unable open the table, PE_ERR_DATABASELOCATION is set,
  2007. //      and the application should update with PESetNthTableLocation.
  2008.  
  2009. PEBOOL  CRPE_API PETestNthTableConnectivity (short printJob,
  2010.                                            short tableN);
  2011.  
  2012. // PELogOnServer and PELogOffServer can be called at any time to log on
  2013. // and off of a database server.  These functions are not required if
  2014. // function PESetNthTableLogOnInfo above was already used to set the
  2015. // password for a table.
  2016. //
  2017. // These functions require a database DLL name, which can be retrieved
  2018. // using PEGetNthTableType above.
  2019. //
  2020. // This function can also be used for non-SQL tables, such as password-
  2021. // protected Paradox tables.  Call this function to set the password
  2022. // for the Paradox DLL before beginning printing.
  2023. //
  2024. // Note: When printing using PEStartPrintJob the ServerName passed in
  2025. // PELogOnServer must agree exactly with the server name stored in the
  2026. // report.  If this is not true use PESetNthTableLogOnInfo to perform
  2027. // logging on instead.
  2028.  
  2029. PEBOOL CRPE_API PELogOnServer (const char FAR *dllName,
  2030.                              PELogOnInfo FAR *logOnInfo);
  2031. PEBOOL CRPE_API PELogOffServer (const char FAR *dllName,
  2032.                               PELogOnInfo FAR *logOnInfo);
  2033.  
  2034. PEBOOL CRPE_API PELogOnSQLServerWithPrivateInfo (const char FAR *dllName,
  2035.                                                void FAR *privateInfo);
  2036.  
  2037. /***************************************/
  2038. // Overriding SQL query in report
  2039. /***************************************/
  2040. //
  2041. // PEGetSQLQuery () returns the same query as appears in the Show SQL Query
  2042. // dialog in CRW, in syntax specific to the database driver you are using.
  2043. //
  2044. // PESetSQLQuery () is mostly useful for reports with SQL queries that
  2045. // were explicitly edited in the Show SQL Query dialog in CRW, i.e. those
  2046. // reports that needed database-specific selection criteria or joins.
  2047. // (Otherwise it is usually best to continue using function calls such as
  2048. // PESetSelectionFormula () and let CRW build the SQL query automatically.)
  2049. //
  2050. // PESetSQLQuery () has the same restrictions as editing in the Show SQL
  2051. // Query dialog; in particular that changes are accepted in the FROM and
  2052. // WHERE clauses but ignored in the SELECT list of fields.
  2053.  
  2054. PEBOOL CRPE_API PEGetSQLQuery (short printJob,
  2055.                              PEHANDLE FAR *textHandle,
  2056.                              short  FAR *textLength);
  2057.  
  2058. PEBOOL CRPE_API PESetSQLQuery (short printJob,
  2059.                              const char FAR *queryString);
  2060.  
  2061. PEBOOL CRPE_API PEVerifyDatabase(short printJob);
  2062.  
  2063. // constants returned from PECheckNthTableDifferences, can be any
  2064. // combination of the following:
  2065. #define PE_TCD_OKAY                          0x00000000
  2066. #define PE_TCD_DATABASENOTFOUND              0x00000001
  2067. #define PE_TCD_SERVERNOTFOUND                0x00000002
  2068. #define PE_TCD_SERVERNOTOPENED               0x00000004
  2069. #define PE_TCD_ALIASCHANGED                  0x00000008
  2070. #define PE_TCD_INDEXESCHANGED                0x00000010
  2071. #define PE_TCD_DRIVERCHANGED                 0x00000020
  2072. #define PE_TCD_DICTIONARYCHANGED             0x00000040
  2073. #define PE_TCD_FILETYPECHANGED               0x00000080
  2074. #define PE_TCD_RECORDSIZECHANGED             0x00000100
  2075. #define PE_TCD_ACCESSCHANGED                 0x00000200
  2076. #define PE_TCD_PARAMETERSCHANGED             0x00000400
  2077. #define PE_TCD_LOCATIONCHANGED               0x00000800
  2078. #define PE_TCD_DATABASEOTHER                 0x00001000
  2079. #define PE_TCD_NUMFIELDSCHANGED              0x00010000
  2080. #define PE_TCD_FIELDOTHER                    0x00020000
  2081. #define PE_TCD_FIELDNAMECHANGED              0x00040000
  2082. #define PE_TCD_FIELDDESCCHANGED              0x00080000
  2083. #define PE_TCD_FIELDTYPECHANGED              0x00100000
  2084. #define PE_TCD_FIELDSIZECHANGED              0x00200000
  2085. #define PE_TCD_NATIVEFIELDTYPECHANGED        0x00400000
  2086. #define PE_TCD_NATIVEFIELDOFFSETCHANGED      0x00800000
  2087. #define PE_TCD_NATIVEFIELDSIZECHANGED        0x01000000
  2088. #define PE_TCD_FIELDDECPLACESCHANGED         0x02000000
  2089.  
  2090. typedef struct PETableDifferenceInfo
  2091. {
  2092. #if defined (__cplusplus)
  2093.     PETableDifferenceInfo ()
  2094.     {
  2095.         StructSize = sizeof (PETableDifferenceInfo);
  2096.         tableDifferences = 0;
  2097.     };
  2098. #endif
  2099.  
  2100.     PEWORD StructSize;
  2101.     PEDWORD tableDifferences;                 // any combination of PE_TCD_*
  2102.     PEDWORD reserved1;                        // reserved - do not use
  2103.     PEDWORD reserved2;                        // reserved - do not use
  2104. } PETableDifferenceInfo;
  2105.  
  2106. #define PE_SIZEOF_TABLE_DIFFERENCE_INFO (sizeof (PETableDifferenceInfo))
  2107.  
  2108. // Not implemented for reports based on dictionary returns PE_ERR_NOTIMPLEMENTED
  2109. PEBOOL CRPE_API PECheckNthTableDifferences (short printJob, short tableN, PETableDifferenceInfo FAR *tabledifferenceinfo);
  2110.  
  2111. /*******************************/
  2112. // Saved data
  2113. /*******************************/
  2114. //
  2115. // Use PEHasSavedData() to find out if a report currently has saved data
  2116. // associated with it.  This may or may not be PETRUE when a print job is
  2117. // first opened from a report file.  Since data is saved during a print,
  2118. // this will always be PETRUE immediately after a report is printed.
  2119. //
  2120. // Use PEDiscardSavedData() to release the saved data associated with a
  2121. // report.  The next time the report is printed, it will get current data
  2122. // from the database.
  2123. //
  2124. // The default behavior is for a report to use its saved data, rather than
  2125. // refresh its data from the database when printing a report.
  2126.  
  2127. PEBOOL CRPE_API PEHasSavedData (short printJob,
  2128.                               PEBOOL FAR *hasSavedData);
  2129. PEBOOL CRPE_API PEDiscardSavedData (short printJob);
  2130.  
  2131. /*************************/
  2132. // Report title
  2133. /*************************/
  2134.  
  2135. PEBOOL CRPE_API PEGetReportTitle (short printJob,
  2136.                                 PEHANDLE FAR *titleHandle,
  2137.                                 short  FAR *titleLength);
  2138. PEBOOL CRPE_API PESetReportTitle (short printJob,
  2139.                                 const char FAR *title);
  2140.  
  2141.  
  2142. /*************************************/
  2143. // Controlling print to window
  2144. /*************************************/
  2145.  
  2146. PEBOOL CRPE_API PEOutputToWindow (short printJob,
  2147.                                 const char FAR *title,
  2148.                                 int left,
  2149.                                 int top,
  2150.                                 int width,
  2151.                                 int height,
  2152.                                 PEDWORD style,
  2153.                                 PEHWND parentWindow);
  2154.  
  2155. typedef struct PEWindowOptions
  2156. {
  2157. #if defined (__cplusplus)
  2158.     PEWindowOptions ()
  2159.     {
  2160.         StructSize = sizeof (PEWindowOptions);
  2161.         hasGroupTree = PE_UNCHANGED;
  2162.         canDrillDown = PE_UNCHANGED;
  2163.         hasNavigationControls = PE_UNCHANGED;
  2164.         hasCancelButton = PE_UNCHANGED;
  2165.         hasPrintButton = PE_UNCHANGED;
  2166.         hasExportButton = PE_UNCHANGED;
  2167.         hasZoomControl = PE_UNCHANGED;
  2168.         hasCloseButton = PE_UNCHANGED;
  2169.         hasProgressControls = PE_UNCHANGED;
  2170.         hasSearchButton = PE_UNCHANGED;
  2171.         hasPrintSetupButton = PE_UNCHANGED;
  2172.         hasRefreshButton = PE_UNCHANGED;
  2173.         showToolbarTips = PE_UNCHANGED;
  2174.         showDocumentTips = PE_UNCHANGED;
  2175.         hasLaunchButton = PE_UNCHANGED;
  2176.     };
  2177. #endif
  2178.  
  2179.     PEWORD StructSize;                // initialize to PE_SIZEOF_WINDOW_OPTIONS
  2180.  
  2181.     short hasGroupTree;             // PEBOOL value, except use PE_UNCHANGED for no change
  2182.     short canDrillDown;             // PEBOOL value, except use PE_UNCHANGED for no change
  2183.     short hasNavigationControls;    // PEBOOL value, except use PE_UNCHANGED for no change
  2184.     short hasCancelButton;          // PEBOOL value, except use PE_UNCHANGED for no change
  2185.     short hasPrintButton;           // PEBOOL value, except use PE_UNCHANGED for no change
  2186.     short hasExportButton;          // PEBOOL value, except use PE_UNCHANGED for no change
  2187.     short hasZoomControl;           // PEBOOL value, except use PE_UNCHANGED for no change
  2188.     short hasCloseButton;           // PEBOOL value, except use PE_UNCHANGED for no change
  2189.     short hasProgressControls;      // PEBOOL value, except use PE_UNCHANGED for no change
  2190.     short hasSearchButton;          // PEBOOL value, except use PE_UNCHANGED for no change
  2191.     short hasPrintSetupButton;      // PEBOOL value, except use PE_UNCHANGED for no change
  2192.     short hasRefreshButton;         // PEBOOL value, except use PE_UNCHANGED for no change
  2193.     short showToolbarTips;          // PEBOOL value, except use PE_UNCHANGED for no change
  2194.                                     //      default is PETRUE (*Show* tooltips on toolbar)
  2195.     short showDocumentTips;         // PEBOOL value, except use PE_UNCHANGED for no change
  2196.                                     //      default is PEFALSE (*Hide* tooltips on document)
  2197.     short hasLaunchButton;          // Launch Seagate Analysis button on toolbar.
  2198.                                     // PEBOOL value, except use PE_UNCHANGED for no change
  2199.                                     //      default is PEFALSE
  2200. } PEWindowOptions;
  2201.  
  2202. #define PE_SIZEOF_WINDOW_OPTIONS (sizeof (PEWindowOptions))
  2203.  
  2204. PEBOOL CRPE_API PESetWindowOptions (short printJob,
  2205.                                   PEWindowOptions FAR *options);
  2206.  
  2207. PEBOOL CRPE_API PEGetWindowOptions (short printJob,
  2208.                                   PEWindowOptions FAR *options);
  2209.  
  2210. PEHWND CRPE_API PEGetWindowHandle (short printJob);
  2211.  
  2212. void CRPE_API PECloseWindow (short printJob);
  2213.  
  2214.  
  2215. /***********************************/
  2216. // Controlling printed pages
  2217. /*************************************/
  2218.  
  2219. PEBOOL CRPE_API PEShowNextPage (short printJob);
  2220. PEBOOL CRPE_API PEShowFirstPage (short printJob);
  2221. PEBOOL CRPE_API PEShowPreviousPage (short printJob);
  2222. PEBOOL CRPE_API PEShowLastPage (short printJob);
  2223. short CRPE_API PEGetNPages (short printJob);
  2224. PEBOOL CRPE_API PEShowNthPage (short printJob,
  2225.                              short pageN); // start from 1
  2226.  
  2227. #define PE_ZOOM_FULL_SIZE           0
  2228. #define PE_ZOOM_SIZE_FIT_ONE_SIDE   1
  2229. #define PE_ZOOM_SIZE_FIT_BOTH_SIDES 2
  2230.  
  2231. PEBOOL CRPE_API PEZoomPreviewWindow (short printJob,
  2232.                                    short level); // a percent from 25 to 400
  2233.                                                  // or a PE_ZOOM_ constant
  2234.  
  2235. /*************************************************************/
  2236. // Controlling print window when print control buttons hidden
  2237. /*************************************************************/
  2238.  
  2239. PEBOOL CRPE_API PEShowPrintControls (short printJob,
  2240.                                    PEBOOL showPrintControls);
  2241. PEBOOL CRPE_API PEPrintControlsShowing (short printJob,
  2242.                                       PEBOOL FAR *controlsShowing);
  2243.  
  2244. PEBOOL CRPE_API PEPrintWindow (short printJob,
  2245.                              PEBOOL waitUntilDone);
  2246.  
  2247. PEBOOL CRPE_API PEExportPrintWindow (short printJob,
  2248.                                    PEBOOL toMail,
  2249.                                    PEBOOL waitUntilDone);
  2250.  
  2251. PEBOOL CRPE_API PENextPrintWindowMagnification (short printJob);
  2252.  
  2253.  
  2254. /********************************/
  2255. // Changing printer selection
  2256. /********************************/
  2257.  
  2258. // Should not pass uninitialize pointer to DEVMODE structure, 
  2259. // you must new a pointer pointing to structure or initialize it 0
  2260. PEBOOL CRPE_API PESelectPrinter (short printJob,
  2261.                                const char FAR *driverName,
  2262.                                const char FAR *printerName,
  2263.                                const char FAR *portName,
  2264.                                PEDEVMODEA FAR *mode
  2265.                                );
  2266.  
  2267. PEBOOL CRPE_API PEGetSelectedPrinter (short printJob,
  2268.                                     PEHANDLE  FAR *driverHandle,
  2269.                                     short   FAR *driverLength,
  2270.                                     PEHANDLE  FAR *printerHandle,
  2271.                                     short   FAR *printerLength,
  2272.                                     PEHANDLE  FAR *portHandle,
  2273.                                     short   FAR *portLength,
  2274.                                     PEDEVMODEA FAR * FAR *mode
  2275.                                     );
  2276.  
  2277.  
  2278. PEBOOL CRPE_API PEFreeDevMode (short printJob,
  2279.                              PEDEVMODEA FAR * mode
  2280.                              );
  2281.  
  2282.  
  2283. /*********************************/
  2284. // Controlling print to printer
  2285. /*********************************/
  2286.  
  2287. PEBOOL CRPE_API PEOutputToPrinter (short printJob,
  2288.                                  short nCopies);
  2289.  
  2290. PEBOOL CRPE_API PESetNDetailCopies (short printJob,
  2291.                                   short nDetailCopies);
  2292.  
  2293. PEBOOL CRPE_API PEGetNDetailCopies (short printJob,
  2294.                                   short FAR *nDetailCopies);
  2295.  
  2296. // Extension to PESetPrintOptions function: If the 2nd parameter
  2297. // (pointer to PEPrintOptions) is set to 0 (null) the function prompts
  2298. // the user for these options.
  2299. //
  2300. // With this change, you can get the behaviour of the print-to-printer
  2301. // button in the print window by calling PESetPrintOptions with a
  2302. // null pointer and then calling PEPrintWindow.
  2303.  
  2304. #define PE_MAXPAGEN  65535
  2305.  
  2306. #define PE_FILE_PATH_LEN     512
  2307.  
  2308. #define PE_UNCOLLATED       0
  2309. #define PE_COLLATED         1
  2310. #define PE_DEFAULTCOLLATION 2
  2311.  
  2312. typedef struct PEPrintOptions
  2313. {
  2314. #if defined (__cplusplus)
  2315.     PEPrintOptions ()
  2316.     {
  2317.         StructSize = sizeof (PEPrintOptions);
  2318.         startPageN = 0,
  2319.         stopPageN = 0;
  2320.         nReportCopies = 0;
  2321.         collation = 0;
  2322.         outputFileName[0] = '\0';
  2323.     };
  2324. #endif
  2325.  
  2326.     PEWORD StructSize;            // initialize to PE_SIZEOF_PRINT_OPTIONS
  2327.  
  2328.     // page and copy numbers are 1-origin
  2329.     // use 0 to preserve the existing settings
  2330.     unsigned short startPageN,
  2331.                    stopPageN;
  2332.  
  2333.     unsigned short nReportCopies;
  2334.     unsigned short collation;
  2335.     char outputFileName[PE_FILE_PATH_LEN];
  2336. }
  2337.     PEPrintOptions;
  2338. #define PE_SIZEOF_PRINT_OPTIONS (sizeof (PEPrintOptions))
  2339.  
  2340. PEBOOL CRPE_API PESetPrintOptions (short printJob,
  2341.                                  PEPrintOptions FAR *options);
  2342.  
  2343. PEBOOL CRPE_API PEGetPrintOptions (short printJob,
  2344.                                  PEPrintOptions FAR *options);
  2345.  
  2346. /***************************************/
  2347. // Controlling print to file and export
  2348. /**************************************/
  2349.  
  2350. typedef struct PEExportOptions
  2351. {
  2352. #if defined (__cplusplus)
  2353.     PEExportOptions ()
  2354.     {
  2355.         StructSize = sizeof (PEExportOptions);
  2356.         formatDLLName [0] = '\0';
  2357.         formatType = PE_UNCHANGED;
  2358.         formatOptions = 0;
  2359.         destinationDLLName [0] = '\0';
  2360.         destinationType = PE_UNCHANGED;
  2361.         destinationOptions = 0;
  2362.         nFormatOptionsBytes = 0;
  2363.         nDestinationOptionsBytes = 0;
  2364.         unicodeFormatOptions = PEFALSE;
  2365.         unicodeDestinationOptions = PEFALSE;
  2366.     };
  2367. #endif
  2368.  
  2369.     PEWORD StructSize;               // initialize to PE_SIZEOF_EXPORT_OPTIONS
  2370.  
  2371.     char formatDLLName [PE_DLL_NAME_LEN];
  2372.     PEDWORD formatType;
  2373.     void FAR *formatOptions;
  2374.     char destinationDLLName [PE_DLL_NAME_LEN];
  2375.     PEDWORD destinationType;
  2376.     void FAR *destinationOptions;
  2377.     PEWORD nFormatOptionsBytes;      // Set by 'PEGetExportOptions', not set
  2378.                                    // by 'PEDecodeExportOptions', and
  2379.                                    // ignored by 'PEExportTo'.
  2380.     PEWORD nDestinationOptionsBytes; // Set by 'PEGetExportOptions', not set
  2381.                                    // by 'PEDecodeExportOptions', and
  2382.                                    // ignored by 'PEExportTo'.
  2383.     PEBOOL unicodeFormatOptions;
  2384.     PEBOOL unicodeDestinationOptions;
  2385. }
  2386.     PEExportOptions;
  2387. #define PE_SIZEOF_EXPORT_OPTIONS (sizeof (PEExportOptions))
  2388.  
  2389. PEBOOL CRPE_API PEGetExportOptions (short printJob,
  2390.                                     PEExportOptions FAR *options);
  2391.  
  2392. PEBOOL CRPE_API PEExportTo (short printJob,
  2393.                           PEExportOptions FAR *options);
  2394.  
  2395. /************************/
  2396. // Setting page margins
  2397. /************************/
  2398.  
  2399. #define PE_SM_DEFAULT  (short)0x8000
  2400.  
  2401. PEBOOL CRPE_API PESetMargins (short printJob,
  2402.                             short left,
  2403.                             short right,
  2404.                             short top,
  2405.                             short bottom);
  2406.  
  2407. PEBOOL CRPE_API PEGetMargins (short printJob,
  2408.                             short FAR *left,
  2409.                             short FAR *right,
  2410.                             short FAR *top,
  2411.                             short FAR *bottom);
  2412.  
  2413. #define PE_SI_APPLICATION_NAME_LEN  128
  2414. #define PE_SI_TITLE_LEN 128
  2415. #define PE_SI_SUBJECT_LEN 128
  2416. #define PE_SI_AUTHOR_LEN 128
  2417. #define PE_SI_KEYWORDS_LEN 128
  2418. #define PE_SI_COMMENTS_LEN 512
  2419. #define PE_SI_REPORT_TEMPLATE_LEN 128
  2420.  
  2421. typedef struct PEReportSummaryInfo
  2422. {
  2423. #if defined (__cplusplus)
  2424.     PEReportSummaryInfo ()
  2425.     {
  2426.         StructSize = sizeof (PEReportSummaryInfo);
  2427.         applicationName[0] = '\0';
  2428.         title[0] = '\0';
  2429.         subject[0] = '\0';
  2430.         author[0] = '\0';
  2431.         keywords[0] = '\0';
  2432.         comments[0] = '\0';
  2433.         reportTemplate[0] = '\0';
  2434.         savePreviewPicture = PE_UNCHANGED;
  2435.     };
  2436. #endif
  2437.  
  2438.     PEWORD StructSize;
  2439.     char applicationName[PE_SI_APPLICATION_NAME_LEN]; // read only.
  2440.     char title[PE_SI_TITLE_LEN];
  2441.     char subject[PE_SI_SUBJECT_LEN];
  2442.     char author[PE_SI_AUTHOR_LEN];
  2443.     char keywords[PE_SI_KEYWORDS_LEN];
  2444.     char comments[PE_SI_COMMENTS_LEN];
  2445.     char reportTemplate[PE_SI_REPORT_TEMPLATE_LEN];
  2446.     short savePreviewPicture; // PEBOOL PE_UNCHANGED for no change
  2447. } PEReportSummaryInfo;
  2448.  
  2449. #define PE_SIZEOF_REPORT_SUMMARY_INFO (sizeof(PEReportSummaryInfo))
  2450. PEBOOL CRPE_API PEGetReportSummaryInfo(short printJob, PEReportSummaryInfo FAR * summaryInfo);
  2451. PEBOOL CRPE_API PESetReportSummaryInfo(short printJob, PEReportSummaryInfo FAR * summaryInfo);
  2452.  
  2453. /************************************************/
  2454. // Event support
  2455. /***************************************************/
  2456. // event ID
  2457. #define PE_CLOSE_PRINT_WINDOW_EVENT           1
  2458. #define PE_ACTIVATE_PRINT_WINDOW_EVENT        2
  2459. #define PE_DEACTIVATE_PRINT_WINDOW_EVENT      3
  2460. #define PE_PRINT_BUTTON_CLICKED_EVENT         4
  2461. #define PE_EXPORT_BUTTON_CLICKED_EVENT        5
  2462. #define PE_ZOOM_LEVEL_CHANGING_EVENT          6
  2463. #define PE_FIRST_PAGE_BUTTON_CLICKED_EVENT    7
  2464. #define PE_PREVIOUS_PAGE_BUTTON_CLICKED_EVENT 8
  2465. #define PE_NEXT_PAGE_BUTTON_CLICKED_EVENT     9
  2466. #define PE_LAST_PAGE_BUTTON_CLICKED_EVENT     10
  2467. #define PE_CANCEL_BUTTON_CLICKED_EVENT        11
  2468. #define PE_CLOSE_BUTTON_CLICKED_EVENT         12
  2469. #define PE_SEARCH_BUTTON_CLICKED_EVENT        13
  2470. #define PE_GROUP_TREE_BUTTON_CLICKED_EVENT    14
  2471. #define PE_PRINT_SETUP_BUTTON_CLICKED_EVENT   15
  2472. #define PE_REFRESH_BUTTON_CLICKED_EVENT       16
  2473. #define PE_SHOW_GROUP_EVENT                   17
  2474. #define PE_DRILL_ON_GROUP_EVENT               18 // include drill on graph
  2475. #define PE_DRILL_ON_DETAIL_EVENT              19
  2476. #define PE_READING_RECORDS_EVENT              20
  2477. #define PE_START_EVENT                        21
  2478. #define PE_STOP_EVENT                         22
  2479. #define PE_MAPPING_FIELD_EVENT                23
  2480. #define PE_RIGHT_CLICK_EVENT                  24 // right mouse click
  2481. #define PE_LEFT_CLICK_EVENT                   25 // left mouse click
  2482. #define PE_MIDDLE_CLICK_EVENT                 26 // middle mouse click
  2483. #define PE_DRILL_ON_HYPERLINK_EVENT           27
  2484. #define PE_LAUNCH_SEAGATE_ANALYSIS_EVENT      28
  2485.  
  2486.  
  2487. // job destination
  2488. #define PE_TO_NOWHERE                   0
  2489. #define PE_TO_WINDOW                    1
  2490. #define PE_TO_PRINTER                   2
  2491. #define PE_TO_EXPORT                    3
  2492. #define PE_FROM_QUERY                   4
  2493.  
  2494. // mouse click action
  2495. #define PE_MOUSE_NOTSUPPORTED   0
  2496. #define PE_MOUSE_DOWN           1
  2497. #define PE_MOUSE_UP             2
  2498. #define PE_MOUSE_DOUBLE_CLICK   3
  2499.  
  2500. // mouse click flags (virtual key state-masks)
  2501. #define PE_CF_NONE       0x0000
  2502. #define PE_CF_LBUTTON    0x0001
  2503. #define PE_CF_RBUTTON    0x0002
  2504. #define PE_CF_SHIFTKEY   0x0004
  2505. #define PE_CF_CONTROLKEY 0x0008
  2506. #define PE_CF_MBUTTON    0x0010
  2507.  
  2508. // for PE_*_CLICK_EVENT
  2509. typedef struct PEMouseClickEventInfo
  2510. {
  2511. #if defined (__cplusplus)
  2512.     PEMouseClickEventInfo ()
  2513.     {
  2514.         StructSize = sizeof (PEMouseClickEventInfo);
  2515.         windowHandle = PE_UNCHANGED;
  2516.         clickAction = PE_UNCHANGED;
  2517.         clickFlags = PE_UNCHANGED;
  2518.         xOffset = 0;
  2519.         yOffset = 0;
  2520.         //PEValueInfo fieldValue; TODO check if this constructor gets called
  2521.         objectHandle = 0;
  2522.         sectionCode = PE_UNCHANGED;
  2523.     };
  2524. #endif
  2525.  
  2526.         PEWORD StructSize;
  2527.         long windowHandle;
  2528.         PEUINT clickAction;           // one of PE_MOUSE_*
  2529.         PEUINT clickFlags;            // any combination of PE_CF_*
  2530.         int xOffset;                // x-coordinate of mouse click in pixels
  2531.         int yOffset;                // y-coordinate of mouse click in pixels
  2532.         PEValueInfo fieldValue;     // value of object at click point if it is a field
  2533.                                     // object, excluding MEMO and BLOB fields,
  2534.                                     // else valueType element = PE_VI_NOVALUE.
  2535.         PEDWORD objectHandle;         // the design view object
  2536.         short sectionCode;          // section in which click occurred.
  2537. } PEMouseClickEventInfo;
  2538. #define PE_SIZEOF_MOUSE_CLICK_EVENT_INFO (sizeof(PEMouseClickEventInfo))
  2539.  
  2540. // for PE_START_EVENT
  2541. typedef struct PEStartEventInfo
  2542. {
  2543. #if defined (__cplusplus)
  2544.     PEStartEventInfo ()
  2545.     {
  2546.         StructSize = sizeof (PEStartEventInfo);
  2547.         destination = PE_UNCHANGED;
  2548.     };
  2549. #endif
  2550.  
  2551.         PEWORD StructSize;
  2552.         PEWORD destination;
  2553. } PEStartEventInfo;
  2554. #define PE_SIZEOF_START_EVENT_INFO (sizeof(PEStartEventInfo))
  2555.  
  2556. // for PE_STOP_EVENT
  2557. typedef struct PEStopEventInfo
  2558. {
  2559. #if defined (__cplusplus)
  2560.     PEStopEventInfo ()
  2561.     {
  2562.         StructSize = sizeof (PEStopEventInfo);
  2563.         destination = PE_UNCHANGED;
  2564.         jobStatus = PE_UNCHANGED;
  2565.     };
  2566. #endif
  2567.  
  2568.         PEWORD StructSize;
  2569.         PEWORD destination;
  2570.         PEWORD jobStatus; // a PE_JOB constant
  2571. } PEStopEventInfo;
  2572. #define PE_SIZEOF_STOP_EVENT_INFO (sizeof(PEStopEventInfo))
  2573.  
  2574. // for PE_READING_RECORDS_EVENT
  2575. typedef struct PEReadingRecordsEventInfo
  2576. {
  2577. #if defined (__cplusplus)
  2578.     PEReadingRecordsEventInfo ()
  2579.     {
  2580.         StructSize = sizeof (PEReadingRecordsEventInfo);
  2581.         cancelled = PE_UNCHANGED;
  2582.         recordsRead = PE_UNCHANGED;
  2583.         recordsSelected = PE_UNCHANGED;
  2584.         done = PE_UNCHANGED;
  2585.     };
  2586. #endif
  2587.  
  2588.         PEWORD StructSize;
  2589.         short cancelled; // PEBOOL value.
  2590.         long recordsRead;
  2591.         long recordsSelected;
  2592.         short done;             // PEBOOL value.
  2593. } PEReadingRecordsEventInfo;
  2594.  
  2595. #define PE_SIZEOF_READING_RECORDS_EVENT_INFO (sizeof(PEReadingRecordsEventInfo))
  2596.  
  2597. // use this structure for
  2598. // PE_CLOSE_PRINT_WINDOW_EVENT
  2599. // PE_PRINT_BUTTON_CLICKED_EVENT
  2600. // PE_EXPORT_BUTTON_CLICKED_EVENT
  2601. // PE_FIRST_PAGE_BUTTON_CLICKED_EVENT
  2602. // PE_PREVIOUS_PAGE_BUTTON_CLICKED_EVENT
  2603. // PE_NEXT_PAGE_BUTTON_CLICKED_EVENT
  2604. // PE_LAST_PAGE_BUTTON_CLICKED_EVENT
  2605. // PE_CANCEL_BUTTON_CLICKED_EVENT
  2606. // PE_PRINT_SETUP_BUTTON_CLICKED_EVENT
  2607. // PE_REFRESH_BUTTON_CLICKED_EVENT
  2608. // PE_ACTIVATE_PRINT_WINDOW_EVENT
  2609. // PE_DEACTIVATE_PRINT_WINDOW_EVENT
  2610. typedef struct PEGeneralPrintWindowEventInfo
  2611. {
  2612. #if defined (__cplusplus)
  2613.     PEGeneralPrintWindowEventInfo ()
  2614.     {
  2615.         StructSize = sizeof (PEGeneralPrintWindowEventInfo);
  2616.         windowHandle = 0;
  2617.     };
  2618. #endif
  2619.  
  2620.         PEWORD StructSize;
  2621.         PEWORD ignored; // for 4 byte alignment. ignore.
  2622.         long windowHandle; // PEHWND
  2623. } PEGeneralPrintWindowEventInfo;
  2624.  
  2625. #define PE_SIZEOF_GENERAL_PRINT_WINDOW_EVENT_INFO (sizeof(PEGeneralPrintWindowEventInfo))
  2626.  
  2627. // for PE_ZOOM_CONTROL_SELECTED_EVENT
  2628. typedef struct PEZoomLevelChangingEventInfo
  2629. {
  2630. #if defined (__cplusplus)
  2631.     PEZoomLevelChangingEventInfo ()
  2632.     {
  2633.         StructSize = sizeof (PEZoomLevelChangingEventInfo);
  2634.         zoomLevel = PE_UNCHANGED;
  2635.         windowHandle = 0;
  2636.     };
  2637. #endif
  2638.  
  2639.         PEWORD StructSize;
  2640.         PEWORD zoomLevel;
  2641.         long windowHandle;
  2642. } PEZoomLevelChaningEventInfo;
  2643.  
  2644. #define PE_SIZEOF_ZOOM_LEVEL_CHANGING_EVENT_INFO (sizeof (PEZoomLevelChangingEventInfo))
  2645.  
  2646. // for PE_CLOSE_BUTTON_CLICKED_EVENT
  2647. typedef struct PECloseButtonClickedEventInfo
  2648. {
  2649. #if defined (__cplusplus)
  2650.     PECloseButtonClickedEventInfo ()
  2651.     {
  2652.         StructSize = sizeof (PECloseButtonClickedEventInfo);
  2653.         viewIndex = PE_UNCHANGED;
  2654.         windowHandle = 0;
  2655.     };
  2656. #endif
  2657.  
  2658.         PEWORD StructSize;
  2659.         PEWORD viewIndex; // which view is going to be closed. start from zero.
  2660.         long windowHandle; // frame window handle the button is on.
  2661. } PECloseButtonClickedEventInfo;
  2662. #define PE_SIZEOF_CLOSE_BUTTON_CLICKED_EVENT_INFO (sizeof(PECloseButtonClickedEventInfo))
  2663.  
  2664. //for PE_SEARCH_BUTTON_CLICKED_EVENT
  2665. #define PE_SEARCH_STRING_LEN   128
  2666. typedef struct PESearchButtonClickedEventInfo
  2667. {
  2668. #if defined (__cplusplus)
  2669.     PESearchButtonClickedEventInfo ()
  2670.     {
  2671.         StructSize = sizeof (PESearchButtonClickedEventInfo);
  2672.         windowHandle = 0;
  2673.         searchString[0] = '\0';
  2674.     };
  2675. #endif
  2676.  
  2677.         long windowHandle;
  2678.         char searchString[PE_SEARCH_STRING_LEN];
  2679.         PEWORD StructSize;
  2680. } PESearchButtonClickedEventInfo;
  2681. #define PE_SIZEOF_SEARCH_BUTTON_CLICKED_EVENT_INFO (sizeof(PESearchButtonClickedEventInfo))
  2682.  
  2683. //for PE_GROUPTREE_BUTTON_CLICKED_EVENT
  2684. typedef struct PEGroupTreeButtonClickedEventInfo
  2685. {
  2686. #if defined (__cplusplus)
  2687.     PEGroupTreeButtonClickedEventInfo ()
  2688.     {
  2689.         StructSize = sizeof (PEGroupTreeButtonClickedEventInfo);
  2690.         visible = PE_UNCHANGED;
  2691.         windowHandle = 0;
  2692.     };
  2693. #endif
  2694.  
  2695.         PEWORD StructSize;
  2696.         short visible; // PEBOOL value. current state of the group tree button
  2697.         long windowHandle;
  2698. }PEGroupTreeButtonClickedEventInfo;
  2699.  
  2700. #define PE_SIZEOF_GROUP_TREE_BUTTON_CLICKED_EVENT_INFO (sizeof(PEGroupTreeButtonClickedEventInfo))
  2701.  
  2702. //for PE_SHOW_GROUP_EVENT
  2703. typedef struct PEShowGroupEventInfo
  2704. {
  2705. #if defined (__cplusplus)
  2706.     PEShowGroupEventInfo ()
  2707.     {
  2708.         StructSize = sizeof (PEShowGroupEventInfo);
  2709.         groupLevel = PE_UNCHANGED;
  2710.         windowHandle = 0;
  2711.         groupList = 0;
  2712.     };
  2713. #endif
  2714.  
  2715.         PEWORD StructSize;
  2716.         PEWORD groupLevel;
  2717.         long windowHandle;
  2718.         // points to an array of group name. memory pointed by group list is freed after calling the call
  2719.         // back function.
  2720.         char **groupList;
  2721. } PEShowGroupEventInfo;
  2722. #define PE_SIZEOF_SHOW_GROUP_EVENT_INFO (sizeof(PEShowGroupEventInfo))
  2723.  
  2724. //For PE_DRILL_ON_GROUP_EVENT
  2725. #define PE_DE_ON_GROUP       0
  2726. #define PE_DE_ON_GROUPTREE   1
  2727. #define PE_DE_ON_GRAPH       2
  2728. #define PE_DE_ON_MAP         3
  2729. #define PE_DE_ON_SUBREPORT   4
  2730.  
  2731. typedef struct PEDrillOnGroupEventInfo
  2732. {
  2733. #if defined (__cplusplus)
  2734.     PEDrillOnGroupEventInfo ()
  2735.     {
  2736.         StructSize = sizeof (PEDrillOnGroupEventInfo);
  2737.         drillType = PE_UNCHANGED;
  2738.         windowHandle = 0;
  2739.         groupList = 0;
  2740.         groupLevel = 0;
  2741.     };
  2742. #endif
  2743.  
  2744.         PEWORD StructSize;
  2745.         PEWORD drillType; // a PE_DE_ constant
  2746.         long windowHandle;
  2747.         // points to an array of group name. memory pointed by group list is freed after calling the call
  2748.         // back function.
  2749.         char **groupList;   // points to an array of group name for drillOnGroup, drillOnGroupTree, drillOnGraph, drillOnMap
  2750.                             // points to an array with one element, the subreport name, for drillOnSubreport.
  2751.         PEWORD groupLevel;
  2752. }PEDrillOnGroupEventInfo;
  2753. #define PE_SIZEOF_DRILL_ON_GROUP_EVENT_INFO (sizeof(PEDrillOnGroupEventInfo))
  2754.  
  2755. // for PE_DRILL_ON_DETAIL_EVENT
  2756. typedef struct PEFieldValueInfo
  2757. {
  2758. #if defined (__cplusplus)
  2759.     PEFieldValueInfo ()
  2760.     {
  2761.         StructSize = sizeof (PEFieldValueInfo);
  2762.         fieldName [0] = '\0';
  2763.         //PEValueInfo fieldValue; TODO check if this constructor gets called.
  2764.     };
  2765. #endif
  2766.  
  2767.         PEWORD StructSize;
  2768.         PEWORD ignored; // for 4 byte alignment. ignore.
  2769.         char fieldName[PE_FIELD_NAME_LEN];
  2770.         PEValueInfo fieldValue;
  2771. } PEFieldValueInfo;
  2772. #define PE_SIZEOF_FIELD_VALUE_INFO (sizeof(PEFieldValueInfo))
  2773.  
  2774. typedef struct PEDrillOnDetailEventInfo
  2775. {
  2776. #if defined (__cplusplus)
  2777.     PEDrillOnDetailEventInfo ()
  2778.     {
  2779.         StructSize = sizeof (PEDrillOnDetailEventInfo);
  2780.         selectedFieldIndex = PE_UNCHANGED; // -1 if no field selected
  2781.         windowHandle = 0;
  2782.         fieldValueList = 0;
  2783.         nFieldValue = 0; // number of field value in fieldValueList
  2784.     };
  2785. #endif
  2786.  
  2787.     PEWORD StructSize;
  2788.     short selectedFieldIndex; // -1 if no field selected
  2789.     long windowHandle;
  2790.     // points to an array of PEFieldValueInfo. memory pointed by fieldValueList is freed after calling the call
  2791.     // back function.
  2792.     struct PEFieldValueInfo ** fieldValueList;
  2793.     short nFieldValue; // number of field value in fieldValueList
  2794. } PEDrillOnDetailEventInfo;
  2795. #define PE_SIZEOF_DRILL_ON_DETAIL_EVENT_INFO (sizeof(PEDrillOnDetailEventInfo))
  2796.  
  2797. /* -------------------------------------------------------------------------*/
  2798.  
  2799. #define PE_TABLE_NAME_LEN 128
  2800. #define PE_DATABASE_FIELD_NAME_LEN  128
  2801.  
  2802. // Field value type
  2803. #define PE_FVT_INT8SFIELD            1
  2804. #define PE_FVT_INT8UFIELD            2
  2805. #define PE_FVT_INT16SFIELD           3
  2806. #define PE_FVT_INT16UFIELD           4
  2807. #define PE_FVT_INT32SFIELD           5
  2808. #define PE_FVT_INT32UFIELD           6
  2809. #define PE_FVT_NUMBERFIELD           7
  2810. #define PE_FVT_CURRENCYFIELD         8
  2811. #define PE_FVT_BOOLEANFIELD          9
  2812. #define PE_FVT_DATEFIELD             10
  2813. #define PE_FVT_TIMEFIELD             11
  2814. #define PE_FVT_STRINGFIELD           12
  2815. #define PE_FVT_TRANSIENTMEMOFIELD    13
  2816. #define PE_FVT_PERSISTENTMEMOFIELD   14
  2817. #define PE_FVT_BLOBFIELD             15
  2818. #define PE_FVT_DATETIMEFIELD         16
  2819. #define PE_FVT_BITMAPFIELD           17
  2820. #define PE_FVT_ICONFIELD             18
  2821. #define PE_FVT_PICTUREFIELD          19
  2822. #define PE_FVT_OLEFIELD              20
  2823. #define PE_FVT_GRAPHFIELD            21
  2824. #define PE_FVT_UNKNOWNFIELD          22
  2825.  
  2826. // Field mapping types
  2827. #define PE_FM_AUTO_FLD_MAP          0   //Auto field name mapping
  2828.                                         //unmapped report fields will be removed
  2829. #define PE_FM_CRPE_PROMPT_FLD_MAP   1   //CRPE provided dialog box to map field manually
  2830. #define PE_FM_EVENT_DEFINED_FLD_MAP 2   //CPPE provided list of field in report and new database
  2831.                                         //User need to activate the PE_MAPPING_FIELD_EVENT
  2832.                                         //and define a callback function
  2833.  
  2834. PEBOOL CRPE_API PESetFieldMappingType(short printJob,
  2835.                                     PEWORD mappingType);
  2836.  
  2837. PEBOOL CRPE_API PEGetFieldMappingType(short printJob,
  2838.                                     PEWORD FAR * mappingType);
  2839.  
  2840. typedef struct PEReportFieldMappingInfo
  2841. {
  2842. #if defined (__cplusplus)
  2843.     PEReportFieldMappingInfo ()
  2844.     {
  2845.         StructSize = sizeof (PEReportFieldMappingInfo);
  2846.         valueType = PE_UNCHANGED;
  2847.         tableAliasName[0] = '\0';
  2848.         databaseFieldName[0] = '\0';
  2849.         mappingTo = PE_UNCHANGED;
  2850.     };
  2851. #endif
  2852.  
  2853.     PEWORD StructSize;
  2854.     PEWORD valueType; // a PE_FVT_constant
  2855.     char tableAliasName[PE_TABLE_NAME_LEN];
  2856.     char databaseFieldName[PE_DATABASE_FIELD_NAME_LEN];
  2857.     int mappingTo;   //mapped fields are assigned to the index of a field
  2858.                       //in array PEFieldMappingEventInfo->databaseFields
  2859.                       //unmapped fields are assigned to -1
  2860. } PEReportFieldMappingInfo;
  2861. #define PE_SIZEOF_REPORT_FIELDMAPPING_INFO (sizeof(PEReportFieldMappingInfo))
  2862.  
  2863. typedef struct PEFieldMappingEventInfo
  2864. {
  2865. #if defined (__cplusplus)
  2866.     PEFieldMappingEventInfo ()
  2867.     {
  2868.         StructSize = sizeof (PEFieldMappingEventInfo);
  2869.         reportFields = 0;
  2870.         nReportFields = 0;
  2871.         databaseFields = 0;
  2872.         nDatabaseFields = 0;
  2873.     };
  2874. #endif
  2875.  
  2876.     PEWORD StructSize;
  2877.  
  2878.    PEReportFieldMappingInfo ** reportFields; //An array of fields in the report.
  2879.                                             //User need to modify the 'mappingTo' of
  2880.                                             //each new mapped field by assigning the value
  2881.                                             //of the index of a field in the array
  2882.                                             //databaseFields.
  2883.    PEWORD nReportFields;                      //Size of array reportFields
  2884.  
  2885.    PEReportFieldMappingInfo ** databaseFields; //An array of fields in the new database file
  2886.    PEWORD nDatabaseFields;                    //Size of array databaseField
  2887. } PEFieldMappingEventInfo;
  2888. #define PE_SIZEOF_FIELDMAPPING_EVENT_INFO (sizeof(PEFieldMappingEventInfo))
  2889. /* -------------------------------------------------------------------------*/
  2890.  
  2891. typedef struct PEHyperlinkEventInfo
  2892. {
  2893. #if defined (__cplusplus)
  2894.     PEHyperlinkEventInfo ()
  2895.     {
  2896.         StructSize = sizeof (PEHyperlinkEventInfo);
  2897.         windowHandle = 0;
  2898.         hyperlinkText = 0;
  2899.     };
  2900. #endif
  2901.  
  2902.     PEWORD StructSize;
  2903.     PEWORD ignored;               // for 4 byte alignment. ignore.
  2904.     long windowHandle;          // PEHWND
  2905.     char FAR *hyperlinkText;    // points to the hyperlink text associated with the object.
  2906.                                 // memory pointed by hyperlinkText is freed after calling the callback function.
  2907. } PEHyperlinkEventInfo;
  2908.  
  2909. #define PE_SIZEOF_HYPERLINKEVENTINFO (sizeof (PEHyperlinkEventInfo))
  2910.  
  2911. typedef struct PELaunchSeagateAnalysisEventInfo
  2912. {
  2913. #if defined (__cplusplus)
  2914.     PELaunchSeagateAnalysisEventInfo ()
  2915.     {
  2916.         StructSize = sizeof (PELaunchSeagateAnalysisEventInfo);
  2917.         windowHandle = 0;
  2918.         pathFile = 0;
  2919.     };
  2920. #endif
  2921.  
  2922.     PEWORD StructSize;
  2923.     PEWORD ignored;               // for 4 byte alignment. ignore.
  2924.     long windowHandle;          // PEHWND
  2925.     char FAR *pathFile;         // points to the path and filename of the temporary report.
  2926.                                 // memory pointed by pathFile is freed after calling the callback function.
  2927. } PELaunchSeagateAnalysisEventInfo;
  2928.  
  2929. #define PE_SIZEOF_LAUNCH_SEAGATE_ANALYSIS_EVENT_INFO (sizeof (PELaunchSeagateAnalysisEventInfo))
  2930.  
  2931. // All events are disabled by default
  2932. // use PEEnableEvent to enable events.
  2933. typedef struct PEEnableEventInfo
  2934. {
  2935. #if defined (__cplusplus)
  2936.     PEEnableEventInfo ()
  2937.     {
  2938.         StructSize = sizeof (PEEnableEventInfo);
  2939.         startStopEvent = PE_UNCHANGED;
  2940.         readingRecordEvent = PE_UNCHANGED;
  2941.         printWindowButtonEvent = PE_UNCHANGED;
  2942.         drillEvent = PE_UNCHANGED;
  2943.         closePrintWindowEvent = PE_UNCHANGED;
  2944.         activatePrintWindowEvent = PE_UNCHANGED;
  2945.         fieldMappingEvent = PE_UNCHANGED;
  2946.         mouseClickEvent = PE_UNCHANGED;
  2947.         hyperlinkEvent = PE_UNCHANGED;
  2948.         launchSeagateAnalysisEvent = PE_UNCHANGED;
  2949.         formattingEvent = PE_UNCHANGED;
  2950.     };
  2951. #endif
  2952.  
  2953.     PEWORD StructSize;
  2954.     short startStopEvent; // PEBOOL value, PE_UNCHANGED for no change
  2955.     short readingRecordEvent; // PEBOOL value, PE_UNCHANGED for no change
  2956.     short printWindowButtonEvent; // PEBOOL value, PE_UNCHANGED for no change
  2957.     short drillEvent; // PEBOOL value, PE_UNCHANGED for no change
  2958.     short closePrintWindowEvent; // PEBOOL value, PE_UNCHANGED for no change
  2959.     short activatePrintWindowEvent; // PEBOOL value, PE_UNCHANGED for no change
  2960.     short fieldMappingEvent; // PEBOOL value, PE_UNCHANGED for no change.
  2961.     short mouseClickEvent; // PEBOOL value, PE_UNCHANGED for no change.
  2962.     short hyperlinkEvent;   // PEBOOL value, PE_UNCHANGED for no change.
  2963.     short launchSeagateAnalysisEvent;   // PEBOOL value, PE_UNCHANGED for no change.
  2964.     short formattingEvent; // PEBOOL value, PE_UNCHANGED for no change.
  2965. } PEEnableEventInfo;
  2966.  
  2967. #define PE_SIZEOF_ENABLE_EVENT_INFO (sizeof(PEEnableEventInfo))
  2968.  
  2969. PEBOOL CRPE_API PEEnableEvent(short printJob, PEEnableEventInfo FAR * enableEventInfo);
  2970. PEBOOL CRPE_API PEGetEnableEventInfo(short printJob, PEEnableEventInfo FAR * enableEventInfo);
  2971.  
  2972. // Set callback function
  2973. PEBOOL CRPE_API PESetEventCallback(short printJob, PEBOOL (PECALLBACK * callbackProc)(short eventID, void *param, void *userData), void *userData);
  2974. /* -------------------------------------------------------------------------*/
  2975.  
  2976. // all are window standard cursors except PE_TC_MAGNIFY_CURSOR.
  2977. // PE_TC_SIZEALL_CURSOR, PE_TC_NO_CURSOR, PE_TC_APPSTARTING_CURSOR
  2978. // and PE_TC_HELP_CURSOR are not supported in 16bit. 
  2979. // PE_TC_SIZE_CURSOR and PE_TC_ICON_CURSOR are obsolete for 32bit
  2980. // use PE_TC_SIZEALL_CURSOR and PE_TC_ARROW_CURSOR instead.
  2981.  
  2982. #define PE_TC_DEFAULT_CURSOR     0 // CRPE set default cursor to be PE_TC_ARRAOW_CURSOR
  2983. #define PE_TC_ARROW_CURSOR       1
  2984. #define PE_TC_CROSS_CURSOR       2
  2985. #define PE_TC_IBEAM_CURSOR       3
  2986. #define PE_TC_UPARROW_CURSOR     4
  2987. #define PE_TC_SIZEALL_CURSOR     5
  2988. #define PE_TC_SIZENWSE_CURSOR    6
  2989. #define PE_TC_SIZENESW_CURSOR    7
  2990. #define PE_TC_SIZEWE_CURSOR      8
  2991. #define PE_TC_SIZENS_CURSOR      9
  2992. #define PE_TC_NO_CURSOR          10
  2993. #define PE_TC_WAIT_CURSOR        11
  2994. #define PE_TC_APPSTARTING_CURSOR 12
  2995. #define PE_TC_HELP_CURSOR        13
  2996. #define PE_TC_SIZE_CURSOR        14 // for 16bit
  2997. #define PE_TC_ICON_CURSOR        15 // for 16bit
  2998.  
  2999.  // CRPE specific cusors
  3000. #define PE_TC_BACKGROUND_PROCESS_CURSOR 94
  3001. #define PE_TC_GRAB_HAND_CURSOR          95
  3002. #define PE_TC_ZOOM_IN_CURSOR            96
  3003. #define PE_TC_REPORT_SECTION_CURSOR     97
  3004. #define PE_TC_HAND_CURSOR               98
  3005. #define PE_TC_MAGNIFY_CURSOR            99  // CRPE specific cusor
  3006.  
  3007. typedef struct PETrackCursorInfo
  3008. {
  3009. #if defined (__cplusplus)
  3010.     PETrackCursorInfo ()
  3011.     {
  3012.         StructSize = sizeof (PETrackCursorInfo);
  3013.         groupAreaCursor = PE_UNCHANGED;
  3014.         groupAreaFieldCursor = PE_UNCHANGED;
  3015.         detailAreaCursor = PE_UNCHANGED;
  3016.         detailAreaFieldCursor = PE_UNCHANGED;
  3017.         graphCursor = PE_UNCHANGED;
  3018.         groupAreaCursorHandle = PE_UNCHANGED;
  3019.         groupAreaFieldCursorHandle = PE_UNCHANGED;
  3020.         detailAreaCursorHandle = PE_UNCHANGED;
  3021.         detailAreaFieldCursorHandle = PE_UNCHANGED;
  3022.         graphCursorHandle = PE_UNCHANGED;
  3023.         ondemandSubreportCursor = PE_UNCHANGED;
  3024.         hyperlinkCursor = PE_UNCHANGED;
  3025.     };
  3026. #endif
  3027.  
  3028.         PEWORD StructSize;
  3029.         short groupAreaCursor; // a PE_TC constant. PE_UNCHANGED for no change.
  3030.         short groupAreaFieldCursor; // a PE_TC constant. PE_UNCHAGNED for no change.
  3031.         short detailAreaCursor;  // a PE_TC constant. PE_UNCHANGED for no change
  3032.         short detailAreaFieldCursor; // a PE_TC constant. PE_UNCHANGED for no change
  3033.         short graphCursor;                      // a PE_TC constant. PE_UNCHANGED for no change.
  3034.         long groupAreaCursorHandle; // reserved
  3035.         long groupAreaFieldCursorHandle; // reserved
  3036.         long detailAreaCursorHandle; // reserved
  3037.         long detailAreaFieldCursorHandle; // reserved
  3038.         long graphCursorHandle; // reserved
  3039.         short ondemandSubreportCursor;  // Cursor to show over on-demand subreports when
  3040.                                         // drilldown for the window is enabled;
  3041.                                         // default is PE_TC_MAGNIFY_CURSOR.
  3042.         short hyperlinkCursor;          // Cursor to show over report object that has hyperlink text;
  3043.                                         // default is PE_TC_HAND_CURSOR.
  3044. } PETrackCursorInfo;
  3045. #define PE_SIZEOF_TRACK_CURSOR_INFO  (sizeof(PETrackCursorInfo))
  3046.  
  3047. // set tracking cursor
  3048. PEBOOL CRPE_API PESetTrackCursorInfo(short printJob,
  3049.                                    PETrackCursorInfo FAR * cursorInfo);
  3050. PEBOOL CRPE_API PEGetTrackCursorInfo(short printJob,
  3051.                                    PETrackCursorInfo FAR * cursorInfo);
  3052.  
  3053. /* ******************************* */
  3054. /* Report Alerting                 */
  3055. /* ******************************* */
  3056.  
  3057. typedef struct PEReportAlertInfo
  3058. {
  3059. #if defined (__cplusplus)
  3060.     PEReportAlertInfo ()
  3061.     {
  3062.         StructSize = sizeof (PEReportAlertInfo);
  3063.         nameLength = PE_UNCHANGED;
  3064.         name = 0;
  3065.         isEnabled = PE_UNCHANGED;
  3066.         alertConditionLength = PE_UNCHANGED;
  3067.         alertConditionFormula = 0;
  3068.         nTriggeredInstances = 0;
  3069.         alertMessageLength = 0;
  3070.         defaultAlertMessageLength = 0;
  3071.         alertMessageFormula = 0;
  3072.         defaultAlertMessage = 0;
  3073.     };
  3074. #endif
  3075.  
  3076.     PEWORD StructSize;    // initialized to be PE_SIZEOF_REPORT_ALERT_INFO
  3077.     short nameLength;
  3078.     PEHANDLE name;        // NOTE: must release HANDLEs even not using them
  3079.     short isEnabled;    // PETRUE if alert is enabled, else PEFALSE
  3080.     short alertConditionLength;
  3081.     PEHANDLE alertConditionFormula;
  3082.     PEDWORD nTriggeredInstances;  // the number of times the alert was triggered
  3083.     short alertMessageLength;
  3084.     short defaultAlertMessageLength;
  3085.     PEHANDLE alertMessageFormula;
  3086.     PEHANDLE defaultAlertMessage;
  3087. } PEReportAlertInfo;
  3088. #define PE_SIZEOF_REPORT_ALERT_INFO (sizeof (PEReportAlertInfo))
  3089.  
  3090. typedef struct PEAlertInstanceInfo
  3091. {
  3092. #if defined (__cplusplus)
  3093.     PEAlertInstanceInfo ()
  3094.     {
  3095.         StructSize = sizeof (PEAlertInstanceInfo);
  3096.         alertMessageLength = PE_UNCHANGED;
  3097.         alertMessage = 0;
  3098.     };
  3099. #endif
  3100.  
  3101.     PEWORD StructSize;    // initialized to be PE_SIZEOF_ALERT_INSTANCE_INFO
  3102.     short alertMessageLength;
  3103.     PEHANDLE alertMessage;
  3104. } PEAlertInstanceInfo;
  3105.  
  3106. #define PE_SIZEOF_ALERT_INSTANCE_INFO (sizeof (PEAlertInstanceInfo))
  3107.  
  3108. short CRPE_API PEGetNReportAlerts (short printJob);  // return -1 if failed.
  3109.  
  3110. PEBOOL CRPE_API PEGetNthReportAlert (short printJob,
  3111.                                    short alertN,
  3112.                                    PEReportAlertInfo FAR * reportAlertInfo);
  3113.  
  3114. PEBOOL CRPE_API PEGetNthAlertInstanceInfo (short printJob,
  3115.                                          short alertN,
  3116.                                          PEDWORD instanceN,
  3117.                                          PEAlertInstanceInfo FAR * alertInstanceInfo);
  3118.  
  3119. PEBOOL CRPE_API PESetNthAlertConditionFormula (short printJob,
  3120.                                              short alertN,
  3121.                                              const char FAR *formula);
  3122.  
  3123. PEBOOL CRPE_API PESetNthAlertMessageFormula (short printJob,
  3124.                                            short alertN,
  3125.                                            const char FAR *formula);
  3126.  
  3127. PEBOOL CRPE_API PESetNthAlertDefaultMessage (short printJob,
  3128.                                            short alertN,
  3129.                                            const char FAR *text);
  3130.  
  3131. PEBOOL CRPE_API PEEnableNthAlert (short printJob,
  3132.                                 short alertN,
  3133.                                 PEBOOL enabled);
  3134.  
  3135. /* ******************************* */
  3136. /* Formula Syntax                  */
  3137. /* ******************************* */
  3138.  
  3139. #define PE_FS_SIZE      2
  3140.  
  3141. #define PE_FST_CRYSTAL   0
  3142. #define PE_FST_BASIC     1
  3143.  
  3144. typedef struct PEFormulaSyntax
  3145. {
  3146. #if defined (__cplusplus)
  3147.     PEFormulaSyntax ()
  3148.     {
  3149.         StructSize = sizeof (PEFormulaSyntax);
  3150.         memset (formulaSyntax, 0, PE_FS_SIZE * sizeof (short));
  3151.     };
  3152. #endif
  3153.  
  3154.     PEWORD StructSize;
  3155.     short formulaSyntax [PE_FS_SIZE];           // PE_FST_* or PE_UNCHANGED.
  3156. } PEFormulaSyntax;
  3157.  
  3158. #define PE_SIZEOF_FORMULA_SYNTAX (sizeof (PEFormulaSyntax))
  3159.  
  3160. // PESetFormulaSyntax
  3161. // Use this API to set the syntax to use in the next (and all successive)
  3162. // formula API call(s).
  3163. // Set one of PE_FST_* into formulaSyntax[0];
  3164. // formulaSyntax[1] is reserved for internal use.
  3165. // ***Default Behaviour: If any Formula API is called before calling
  3166. //                       PESetFormulaSyntax then PE_FST_CRYSTAL is assumed.
  3167. /////////////////////////////////////////////////////////////////////////
  3168. PEBOOL CRPE_API PESetFormulaSyntax (short printJob, PEFormulaSyntax FAR *formulaSyntax);
  3169.  
  3170. // PEGetFormulaSyntax
  3171. // Indicates the syntax used by the formula addressed in the last formula API call.
  3172. // The syntax type is returned in formulaSyntax[0];
  3173. // formulaSyntax[1] is reserved for internal use.
  3174. // ***Default Behaviour: If this API is called before any Formula API is called
  3175. //                       then the values returned will be PE_UNCHANGED.
  3176. ///////////////////////////////////////////////////////////////////////////////////
  3177. PEBOOL CRPE_API PEGetFormulaSyntax (short printJob, PEFormulaSyntax FAR *formulaSyntax);
  3178.  
  3179. // for 4.x version
  3180. #define PE_ALLLINES  -1
  3181.  
  3182. #if defined (__cplusplus)
  3183. }
  3184. #endif
  3185.  
  3186. // Reset structure alignment
  3187. #if defined (__BORLANDC__)
  3188.   #pragma option -a.
  3189. #elif defined (_MSC_VER)
  3190.   #if _MSC_VER >= 900
  3191.     #pragma pack (pop)
  3192.   #else
  3193.     #pragma pack ()
  3194.   #endif
  3195. #endif
  3196.  
  3197. #endif // CRPE_H
  3198.